How can we set just one axis: either x or y and not both in python matplotlib?

For example if we want to set the y-axis at 70 to 95 on the y-axis and keep the x-axis at the same position, what would be the syntax for this particular command.
I followed the structure of: plt.axis([x1,x2,y1,y2])

You could create an axis with limits with this way. Are you having an issue with it?

If you wanted auto-scaling on one axis but not the other you can do so with axis_reference.autoscale('x') as one example. Alternatively you could plot first and them set the axis limits with axisname.set_xlim(xmin, xmax) though further auto-scaling is disabled unless specified.

This really helped me scaling the axis. Thank you for your help! :slight_smile:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.