Eris
May 7, 2020, 3:55pm
1
I’m trying to change an axis position. For example make the xaxis at y=0 instead of y=-3 here
using Plots
f(x)=x-3
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
https://docs.juliaplots.org/latest/generated/attributes_axis/
maybe you want plot(f, 0, 5, xlabel = "x", ylabel = "y", framestyle = :zerolines)
?
2 Likes
Eris
May 7, 2020, 4:29pm
3
This is good but what I really want is to control the position of the axis not nesccarilly keep it at y=0.
1 Like
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
L_Adam:
plot(f, 0, 5, xlabel = “x”, ylabel = “y”, framestyle = :zerolines)
What about this:
f(x)=x-3
plot(f, 0, 5, xlabel = "x", ylabel = "y", ylims=(0,Inf), xlims=(3,Inf), legend=:topleft)
Eris
May 7, 2020, 6:13pm
6
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?
Eris
May 7, 2020, 6:25pm
8
I used AxisOrigin in Mathemtica to position the x-axis at y=3 and this is the output
I see. A quick (and dirty) way would be to just cheat by manually specifying the tick labels, like this:
plot(
f, 0, 5,
legend=false,
framestyle=:origin,
yticks=(-3:3, ["$i" for i in 0:6])
)
4 Likes
I find that a pretty confusing graph…
5 Likes
Would It be possible to do something like this on a 3D plot? GR has decided I don’t need to see the axes if I want to rotate the plot:
Edit: This reply essentially became a duplicate of this other reply . See visuals and workaround there.