Rotating the axes labels in GR

Hi everyone,

I was trying to use the GR (version: [28b8d3ca] GR v0.53.0) backend with the axes label on the y axis rotated clockwise by 90 degrees. Consider the following snippet

using Plots, LaTeXStrings
gr()
λ_linear = range(1.0, stop=6.0, length=600)
plot(λ_linear, sin.(λ_linear) + sin.(10*λ_linear), xlims=(1, 6), ylims=(-3, 3), color=:blue, xticks=([1,2,3,4,5,6], [L"1", L"2", L"3", L"4", L"5", L"6"]),
yticks = ([-3,-2,-1,0,1,2,3], [L"-3", L"-2", L"-1", L"0", L"1", L"2", L"3"]), label=L"\mathcal{A}_1", size=(1000,800),
tickfont = (18, :black), legendfont = (16, :black), xlabel=L"\lambda_1", ylabel=L"\lambda_2", yguidefontrotation = -90, guidefont = (22, :black),
legend=:topleft, framestyle=:box, marker=true, markersize=4, markerstrokewidth =0, dpi=300)

savefig("trial.png")

but setting the keyword arg yguidefontrotation to -90 (after looking at docs) seems to have no effect. Any hints?

The Plots.jl version I am using is [91a5bcdd] Plots v1.9.1. I haven’t checked out PyPlot yet but wanted to see if GR could work…

[EDIT] With pyplot backend, everything seems to work as expected. But I would still like to know if there is a workaround with GR. As a side note, the size of the ylabel is a bit off if I compare with GR (seems smaller than xlabel)

1 Like

This looks like an obvious bug, since rotation of the x axis label works. Please raise an issue with Plots.jl, if no similar issue exists.

Unfortunately, this alternative syntax shows the same issue:
plot(rand(32), yaxis = ("y", font("Courier",10,0.0,0.0,90.0)), margins=10Plots.mm)

1 Like