From 601df0c9a970aa8377289d269777e6a93b827242 Mon Sep 17 00:00:00 2001 From: t-bltg <13423344+t-bltg@users.noreply.github.com> Date: Thu, 3 Jun 2021 19:00:06 +0200 Subject: [PATCH] GR: allow explicit guidefontrotation (#3529) Co-authored-by: t-bltg --- .zenodo.json | 4 ++++ src/backends/gr.jl | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.zenodo.json b/.zenodo.json index 91bd3d82..bd0e18f1 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -683,6 +683,10 @@ "affiliation": "University of Cambridge", "name": "Will Tebbutt", "type": "Other" + }, + { + "name": "@t-bltg", + "type": "Other" } ], "upload_type": "software" diff --git a/src/backends/gr.jl b/src/backends/gr.jl index 4083444e..acfc1829 100644 --- a/src/backends/gr.jl +++ b/src/backends/gr.jl @@ -1510,8 +1510,10 @@ function gr_label_axis(sp, letter, viewport_plotarea) GR.savestate() gr_set_font(guidefont(axis), sp) guide_position = axis[:guide_position] + angle = float(axis[:guidefontrotation]) # github.com/JuliaPlots/Plots.jl/issues/3089 if letter === :y - GR.setcharup(-1, 0) + angle += 180. # default angle = 0. should yield GR.setcharup(-1, 0) i.e. 180° + GR.setcharup(cosd(angle), sind(angle)) ypos = gr_view_yposition(viewport_plotarea, position(axis[:guidefontvalign])) yalign = alignment(axis[:guidefontvalign]) if guide_position === :right || (guide_position == :auto && mirror) @@ -1522,6 +1524,8 @@ function gr_label_axis(sp, letter, viewport_plotarea) xpos = viewport_plotarea[1] - 0.03 - !mirror * gr_axis_width(sp, axis) end else + angle += 90. # default angle = 0. should yield GR.setcharup(0, 1) i.e. 90° + GR.setcharup(cosd(angle), sind(angle)) xpos = gr_view_xposition(viewport_plotarea, position(axis[:guidefonthalign])) xalign = alignment(axis[:guidefonthalign]) if guide_position === :top || (guide_position == :auto && mirror)