Add position aliases.
This commit is contained in:
parent
10a8520805
commit
d79c66e5b6
15
src/args.jl
15
src/args.jl
@ -159,6 +159,21 @@ const _markerAliases = Dict{Symbol,Symbol}(
|
||||
:spike => :vline,
|
||||
)
|
||||
|
||||
const _positionAliases = Dict{Symbol,Symbol}(
|
||||
:top_left => :topleft,
|
||||
:tl => :topleft,
|
||||
:top_center => :topcenter,
|
||||
:tc => :topcenter,
|
||||
:top_right => :topright,
|
||||
:tr => :topright,
|
||||
:bottom_left => :bottomleft,
|
||||
:bl => :bottomleft,
|
||||
:bottom_center => :bottomcenter,
|
||||
:bc => :bottomcenter,
|
||||
:bottom_right => :bottomright,
|
||||
:br => :bottomright,
|
||||
)
|
||||
|
||||
const _allScales = [:identity, :ln, :log2, :log10, :asinh, :sqrt]
|
||||
const _logScales = [:ln, :log2, :log10]
|
||||
const _logScaleBases = Dict(:ln => e, :log2 => 2.0, :log10 => 10.0)
|
||||
|
||||
@ -557,6 +557,7 @@ function process_annotation(sp::Subplot, positions::Union{AVec{Symbol},Symbol},
|
||||
positions, labs = makevec(positions), makevec(labs)
|
||||
for i in 1:max(length(positions), length(labs))
|
||||
pos, lab = _cycle(positions, i), _cycle(labs, i)
|
||||
pos = get(_positionAliases, pos, pos)
|
||||
if lab == :auto
|
||||
alphabet = "abcdefghijklmnopqrstuvwxyz"
|
||||
push!(anns, (pos, text(string("(", alphabet[sp[:subplot_index]], ")"), font)))
|
||||
@ -570,12 +571,12 @@ end
|
||||
# Give each annotation coordinates based on specified position
|
||||
function locate_annotation(sp::Subplot, pos::Symbol, lab::PlotText)
|
||||
position_multiplier = Dict{Symbol, Tuple{Float64,Float64}}(
|
||||
:top_left => (0.1, 0.9),
|
||||
:top_center => (0.5, 0.9),
|
||||
:top_right => (0.9, 0.9),
|
||||
:bottom_right => (0.9, 0.1),
|
||||
:bottom_left => (0.1, 0.9),
|
||||
:bottom_center => (0.5,0.1),
|
||||
:topleft => (0.1, 0.9),
|
||||
:topcenter => (0.5, 0.9),
|
||||
:topright => (0.9, 0.9),
|
||||
:bottomleft => (0.1, 0.1),
|
||||
:bottomcenter => (0.5, 0.1),
|
||||
:bottomright => (0.9, 0.1),
|
||||
)
|
||||
xmin, xmax = ignorenan_extrema(sp[:xaxis])
|
||||
ymin, ymax = ignorenan_extrema(sp[:yaxis])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user