From 702e41f55d3a91e5e790f0722516fd9e0faf268b Mon Sep 17 00:00:00 2001 From: Simon Christ Date: Sun, 17 May 2020 10:28:21 +0200 Subject: [PATCH] add all guide_positions (#2710) * add all guide_positions * remove show --- src/backends/pgfplotsx.jl | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/backends/pgfplotsx.jl b/src/backends/pgfplotsx.jl index e2275dcb..4876f9e8 100644 --- a/src/backends/pgfplotsx.jl +++ b/src/backends/pgfplotsx.jl @@ -655,6 +655,26 @@ pgfx_get_marker(k) = get( "*", ) +pgfx_get_xguide_pos(k) = get( + ( + top = "at={(0.5,1)},above,", + right = "at={(ticklabel* cs:1.02)}, anchor=west,", + left = "at={(ticklabel* cs:-0.02)}, anchor=east,", + ), + k, + "at={(ticklabel cs:0.5)}, anchor=near ticklabel" +) + +pgfx_get_yguide_pos(k) = get( + ( + top = "at={(ticklabel* cs:1.02)}, anchor=south", + right = "at={(1,0.5)},below,", + bottom = "at={(ticklabel* cs:-0.02)}, anchor=north,", + ), + k, + "at={(ticklabel cs:0.5)}, anchor=near ticklabel" +) + pgfx_get_legend_pos(k) = get( ( top = ("at" => string((0.5, 0.98)), "anchor" => "north"), @@ -1034,10 +1054,10 @@ function pgfx_axis!(opt::PGFPlotsX.Options, sp::Subplot, letter) # axis label position labelpos = "" - if letter == :x && axis[:guide_position] == :top - labelpos = "at={(0.5,1)},above," - elseif letter == :y && axis[:guide_position] == :right - labelpos = "at={(1,0.5)},below," + if letter == :x + labelpos = pgfx_get_xguide_pos(axis[:guide_position]) + elseif letter == :y + labelpos = pgfx_get_yguide_pos(axis[:guide_position]) end # Add label font