From 89d08606ade4dff8b61df8e29fc3a6b009df3b01 Mon Sep 17 00:00:00 2001 From: Filippo Vicentini Date: Tue, 23 Oct 2018 14:05:05 +0200 Subject: [PATCH 1/2] Mirror guides if :guide_position == :auto and :mirror == true Before, guides where mirrored only if guide_position was set. --- src/backends/gr.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 1ae84aab..d1039b53 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -903,7 +903,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) if xaxis[:guide] != "" gr_set_font(guidefont(xaxis)) - if xaxis[:guide_position] == :top + if xaxis[:guide_position] == :top || (xaxis[:guide_position] == :auto && xaxis[:mirror] == true) GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_TOP) gr_text(gr_view_xcenter(), viewport_subplot[4], xaxis[:guide]) else @@ -915,7 +915,7 @@ function gr_display(sp::Subplot{GRBackend}, w, h, viewport_canvas) if yaxis[:guide] != "" gr_set_font(guidefont(yaxis)) GR.setcharup(-1, 0) - if yaxis[:guide_position] == :left + if yaxis[:guide_position] == :right || (yaxis[:guide_position] == :auto && yaxis[:mirror] == true) GR.settextalign(GR.TEXT_HALIGN_CENTER, GR.TEXT_VALIGN_BOTTOM) gr_text(viewport_subplot[2], gr_view_ycenter(), yaxis[:guide]) else From 6be79955001acd1e03d2273b7c04429f0fb2883a Mon Sep 17 00:00:00 2001 From: Filippo Vicentini Date: Tue, 23 Oct 2018 15:58:10 +0200 Subject: [PATCH 2/2] Add paddings to the side where the axis label is --- src/backends/gr.jl | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/backends/gr.jl b/src/backends/gr.jl index d1039b53..836276fd 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -602,11 +602,19 @@ function _update_min_padding!(sp::Subplot{GRBackend}) end # Add margin for x label if sp[:xaxis][:guide] != "" - bottompad += 4mm + if sp[:xaxis][:guide_position] == :top || (sp[:xaxis][:guide_position] == :auto && sp[:xaxis][:mirror] == true) + toppad += 4mm + else + bottompad += 4mm + end end # Add margin for y label if sp[:yaxis][:guide] != "" - leftpad += 4mm + if sp[:yaxis][:guide_position] == :right || (sp[:yaxis][:guide_position] == :auto && sp[:yaxis][:mirror] == true) + rightpad += 4mm + else + leftpad += 4mm + end end if sp[:colorbar_title] != "" rightpad += 4mm