GR: allow explicit guidefontrotation (#3529)

Co-authored-by: t-bltg <t-bltg@users.noreply.github.com>
This commit is contained in:
t-bltg 2021-06-03 19:00:06 +02:00 committed by GitHub
parent 700b5782ec
commit 601df0c9a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -683,6 +683,10 @@
"affiliation": "University of Cambridge", "affiliation": "University of Cambridge",
"name": "Will Tebbutt", "name": "Will Tebbutt",
"type": "Other" "type": "Other"
},
{
"name": "@t-bltg",
"type": "Other"
} }
], ],
"upload_type": "software" "upload_type": "software"

View File

@ -1510,8 +1510,10 @@ function gr_label_axis(sp, letter, viewport_plotarea)
GR.savestate() GR.savestate()
gr_set_font(guidefont(axis), sp) gr_set_font(guidefont(axis), sp)
guide_position = axis[:guide_position] guide_position = axis[:guide_position]
angle = float(axis[:guidefontrotation]) # github.com/JuliaPlots/Plots.jl/issues/3089
if letter === :y 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])) ypos = gr_view_yposition(viewport_plotarea, position(axis[:guidefontvalign]))
yalign = alignment(axis[:guidefontvalign]) yalign = alignment(axis[:guidefontvalign])
if guide_position === :right || (guide_position == :auto && mirror) 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) xpos = viewport_plotarea[1] - 0.03 - !mirror * gr_axis_width(sp, axis)
end end
else 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])) xpos = gr_view_xposition(viewport_plotarea, position(axis[:guidefonthalign]))
xalign = alignment(axis[:guidefonthalign]) xalign = alignment(axis[:guidefonthalign])
if guide_position === :top || (guide_position == :auto && mirror) if guide_position === :top || (guide_position == :auto && mirror)