Can I change axis position in Plots

I’m trying to change an axis position. For example make the xaxis at y=0 instead of y=-3 here

using Plots
plot(f,0,5,xlabel=“x”,ylabel= “y”)

I tried the documentation for Plots but I didn’t find a possible option in axis attributes

maybe you want plot(f, 0, 5, xlabel = "x", ylabel = "y", framestyle = :zerolines)?

1 Like

This is good but what I really want is to control the position of the axis not nesccarilly keep it at y=0.

There is no way to do this rather than modifying the backend plot object after the fact or use the etra_kwargs mechanism, thats currently only implemented for the pgfplotsx backend

1 Like

What about this:

plot(f, 0, 5, xlabel = "x", ylabel = "y", ylims=(0,Inf), xlims=(3,Inf), legend=:topleft)


But that didn’t shift the x-axis, it is still at y=0

For example make the xaxis at y=0

Hmmm, I suppose I don’t understand what the goal is then. Can you post an example of an output you’re trying to achieve?

I used AxisOrigin in Mathemtica to position the x-axis at y=3 and this is the output
Screenshot from 2020-05-07 20-23-25

I see. A quick (and dirty) way would be to just cheat by manually specifying the tick labels, like this:

    f, 0, 5,
    yticks=(-3:3, ["$i" for i in 0:6])



I like it :smile: Thank you!

1 Like

I find that a pretty confusing graph…