In Plots.jl, how does one control the space between ylabel and yaxis?

I was brought here by a Google search because I had something like the following graph:

using LaTeXStrings
using Plots
pyplot()

a = [1e-5, 2e-5, 3e-5, 4e-5, 5e-5]
b = [1e5, 2e6, 3e7, 4e8, 5e9]
c = [1e8, 2e9, 3e10, 4e10, 5e10]

plot(a, b, c,
     camera=(-100,30),
     xlabel=L"\Theta_1", ylabel=L"\Theta_2", zlabel="Z Label",
     xtickfont=(10), ytickfont=(10), ztickfont=(10))

We can easily spot a couple of problems. The first one, which led me here, is the proximity between the labels and the ticks. Another problem is the xticks going through the graph, making the scientific notation almost unreadable.

After some tinkering I finally arrived at a good enough solution. I figured I’d share it here for future reference.

plot(a, b, c,
     camera=(-100,30),
     right_margin=10px,
     xlabel="\n\n\n"*L"\Theta_1", 
     ylabel="\n\n\n"*L"\Theta_2", 
     zlabel="\n\nZ Label",
     xtickfont=(10), ytickfont=(10), ztickfont=(10),
     xrotation=-45,
     zrotation=-45)

Essentially, what did the trick was rotating the ticks and putting some breaklines in the labels (which can be even more useful if you don’t need/want to rotate the ticks).

2 Likes