Reputation: 41225
Imagine the following simple plot with Plots
using Plots
plot([1,2,3,4,5], [1,2,3,4,5])
Output:
How can we change the origin to 0 in the plot above?
Upvotes: 3
Views: 379
Reputation: 41225
It is actually very simple, you can use the arguments xlims
and ylims
and pass 0
and Inf
as the limits to force the axis to an origin of 0. Here is a reproducible example:
using Plots
plot([1,2,3,4,5], [1,2,3,4,5], xlims = [0,Inf], ylims = [0,Inf])
Output:
As you can see the origin has been changed!
Upvotes: 3