From d79c66e5b6604644629348e263fa91d5030cc9a4 Mon Sep 17 00:00:00 2001 From: Andrew Palugniok Date: Sun, 14 Jan 2018 11:45:31 +0000 Subject: [PATCH] Add position aliases. --- src/args.jl | 15 +++++++++++++++ src/components.jl | 13 +++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/args.jl b/src/args.jl index 63b90848..808822b3 100644 --- a/src/args.jl +++ b/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) diff --git a/src/components.jl b/src/components.jl index 20acffc5..2b1284ce 100644 --- a/src/components.jl +++ b/src/components.jl @@ -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])