I want to plot data with matplotlib where equal x and y increments have the same length. This works fine with
ax1.axis('equal')
where ax1 is a subfigure()
However setting the lower limits like this:
ax1.set_xlim(left=lowerlimit)
ax1.set_ylim(bottom=lowerlimit)
doesn't work. I also tried something like this which didn't work either:
ax1.axis('equal', xmin=lowerlimit,ymin=lowerlimit)
Can anyone help me?
Edit: Here a minimal example to show the problem:
import matplotlib.pyplot as plt
fig, ax1 = plt.subplots()
x = [0,1,2,3,4,5]
y = [0,-1,-3,-2,-1,-2]
ax1.plot(x,y)
ax1.set_xlim(0,6)
ax1.set_ylim(0,-6)
ax1.axis('equal')
ax1.set_ylim(bottom=0)
plt.show()
Even though I explicitly set the lower limit of the y-axis to 0 after calling ax1.set_ylim(bottom=0) the lower limit of the plot is -1.
In your MWE, change:
ax1.axis('equal')
with:
ax1.set_aspect('equal',adjustable='box')

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With