Skip to content

Commit

Permalink
default value of titlefontsize in plot utilities set.
Browse files Browse the repository at this point in the history
  • Loading branch information
waltergu committed May 31, 2023
1 parent fa3e72d commit 5c035ec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/Frameworks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,7 @@ Define the recipe for the visualization of an assignment of an algorithm.
"""
@recipe function plot(pack::Tuple{Algorithm, Assignment})
title --> nameof(pack...)
titlefontsize --> 10
attr = seriestype(pack)
isnothing(attr) || begin
seriestype --> attr
Expand Down
11 changes: 7 additions & 4 deletions src/Spatials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,7 @@ end
# plot utilities
block = quote
seriestype --> :path
titlefontsize --> 10
legend --> false
minorgrid --> true
xminorticks --> 10
Expand All @@ -1367,6 +1368,7 @@ end

@recipe function plot(path::ReciprocalPath, y::AbstractVector, data::AbstractMatrix)
seriestype --> :heatmap
titlefontsize --> 10
xticks --> ticks(path)
xlabel --> string(names(path)[1])
xlims --> (0, length(path)-1)
Expand All @@ -1380,6 +1382,7 @@ block = quote
x, y = xaxis(reciprocalspace), yaxis(reciprocalspace)
Δx, Δy= x[2]-x[1], y[2]-y[1]
seriestype --> :heatmap
titlefontsize --> 10
aspect_ratio --> :equal
xlims --> (x[1]-Δx, x[end]+Δx)
ylims --> (y[1]-Δy, y[end]+Δy)
Expand All @@ -1401,7 +1404,7 @@ setup(expr::Expr) = quote
@series begin
isnothing(subtitles) || begin
title := subtitles[i]
isnothing(subtitlefontsize) || (titlefontsize := subtitlefontsize)
titlefontsize := subtitlefontsize
end
subplot := i
clims --> clims
Expand All @@ -1417,9 +1420,9 @@ setup(expr::Expr) = quote
ylabel := ""
LinRange(clims..., 100), [0, 1], [LinRange(clims..., 100)'; LinRange(clims..., 100)']
end
@eval @recipe plot(path::ReciprocalPath, y::AbstractVector, data::AbstractArray{<:Number, 3}; subtitles=nothing, subtitlefontsize=nothing) = $(setup(:(path, y, data[:, :, i])))
@eval @recipe plot(reciprocalspace::BrillouinZone, data::AbstractArray{<:Number, 3}; subtitles=nothing, subtitlefontsize=nothing) = $(setup(:(reciprocalspace, data[:, :, i])))
@eval @recipe plot(reciprocalspace::ReciprocalZone, data::AbstractArray{<:Number, 3}; subtitles=nothing, subtitlefontsize=nothing) = $(setup(:(reciprocalspace, data[:, :, i])))
@eval @recipe plot(path::ReciprocalPath, y::AbstractVector, data::AbstractArray{<:Number, 3}; subtitles=nothing, subtitlefontsize=8) = $(setup(:(path, y, data[:, :, i])))
@eval @recipe plot(reciprocalspace::BrillouinZone, data::AbstractArray{<:Number, 3}; subtitles=nothing, subtitlefontsize=8) = $(setup(:(reciprocalspace, data[:, :, i])))
@eval @recipe plot(reciprocalspace::ReciprocalZone, data::AbstractArray{<:Number, 3}; subtitles=nothing, subtitlefontsize=8) = $(setup(:(reciprocalspace, data[:, :, i])))

# save utilities
function save(filename::AbstractString, path::ReciprocalPath, data::Union{AbstractVector{<:Number}, AbstractMatrix{<:Number}})
Expand Down

0 comments on commit 5c035ec

Please sign in to comment.