[英]Using Matplotlib and iPython, How to reset x and y axis limits to Autoscale?
Using matplotlib and iPython, I have a bunch of plots that I am trying to view (one after the other). 使用matplotlib和iPython,我有一堆我想要查看的图(一个接一个)。 Some plots only contain values from 0 to 1 and some contain values in the millions.
某些图仅包含0到1的值,有些包含数百万的值。
After setting the y axis limits using: 使用以下方法设置y轴限制后:
ylim((.7,1))
I want to be able to reset this to set the limits automatically (as it would have done before). 我希望能够重置此设置以自动设置限制(就像之前所做的那样)。 I am having trouble finding the correct approach.
我找不到正确的方法。
ax = plt.gca() # get the current axes
ax.relim() # make sure all the data fits
ax.autoscale() # auto-scale
# only needed mpl < 1.5
# ax.figure.canvas.draw_idle() # re-draw the figure
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.