Hi, I’m plotting using Plots
and noticed that by default 0,0 is at bottom left. Is there any way by which I can move this to top left (i.e. reverse y-axis).
Thanks
Hi, I’m plotting using Plots
and noticed that by default 0,0 is at bottom left. Is there any way by which I can move this to top left (i.e. reverse y-axis).
Thanks
There’s many ways you can flip the y-axis. After running the plot function, you can run
yflip!(true)
or, if like me you like bundling all the options into the plot function, then, as an example:
using Plots
x = range(0, 10, length = 101)
f(x) = x * (x - 4) * (x - 9)
plot(x, f, yflip = true)
Alternatively,
using Plots
x = range(0, 10, length = 101)
f(x) = x * (x - 4) * (x - 9)
plot(x, f, yaxis = :flip)
which produces the same image above.
Check out the documentation for plotting attributes for more info.