Changing distance between axes and x/y guides?

How do I change the space between the frame/ticks/ticks numbers and the x/y axis guides? E.g. in this case:

plot(x -> x^2,xguide="X-axis",yguide="Y-axis")


(red markings are added to me to show what distance I want to change)

Especially when one does subplots, the distance can become quite significant:

plot(plot(x -> x^2,xguide="X-axis",yguide="Y-axis"),plot(x -> x^3,xguide="X-axis",yguide="Y-axis"),size=(700,350))

image

1 Like

For the 2nd case, a workaround: using Measures and add plot keyword argument to second subplot: left_margin=10mm

So, using

plot(plot(x -> x^2,xguide="X-axis",yguide="Y-axis"),plot(x -> x^3,xguide="X-axis",yguide="Y-axis",left_margin=10mm),size=(700,350))

partially solves it, in that the text is no longer closer to the left plot (than the right plot, to which it belongs):
image

However, the result is that you just get more space inbetweem and the space between the text and frame (of the right plot) does not change. The result is that you just get a very sparse plot, mostly filled with empty space, and less with the actual information.

As you did not specify the backend, take inspectdr(), where you can adjust the plot layout interactively (below is default look without editing):

using Plots; inspectdr()
plot(plot(x -> x^2, xguide="X-axis", yguide="Y-axis"),
     plot(x -> x^3, xguide="X-axis", yguide="Y-axis", size=(700,350)))

Think I am currently on gr (that’s the default?).

That looks really cool! Unfortunately, haven’t gotten those adjustment options, I run your code and get something like this:
image

I have tried it both in Jupyter and VSCode.

Please send the inspectdr() plot to an external window to get interactivity and some layout control. In VS Code settings untick this box.

That worked, thanks.

Great question, I’m having issues with this exact distance. It would be great if this distance could be modified with an axis attribute! My x- and y-axis labels / guides are much too far from their ticklabels, see below, and I don’t know how to fix this. I can replace all the labels by annotations, but this seems a poor hack.