title: Preserve autoscale when clearing axes in matplotlib
body: <p>I want to make a series of plots (meant for creating an animation) and thus I want to reuse the axes and preserve the x and y limits across all plots, so I set <code>ax.autoscale(False)</code>. However, when I clear the axes using plt.cla() to draw the next image, the autoscale setting is overridden so I have to set <code>ax.autoscale(False)</code> and the x and y limits <em>on every iteration</em>.</p>
  
  <pre><code>In [49]: fig = plt.figure(1)
  
  In [50]: ax = fig.add_subplot(1, 1, 1)
  
  In [59]: ax.get_autoscale_on()
  Out[59]: True
  
  In [60]: ax.autoscale(False)
  
  In [61]: ax.get_autoscale_on()
  Out[61]: False
  
  In [62]: plt.cla()
  
  In [63]: ax.get_autoscale_on()
  Out[63]: True
  </code></pre>
  
  <p>so I end up doing <code>ax.lines = []</code> or <code>ax.lines.pop()</code>, but this forces me to set the color on each plot to avoid the color cycling. If I set <code>hold</code> to <code>False</code>, then the autoscale setting is reset every time I call <code>ax.plot()</code>. Is there any other way to preserve the axes properties while removing all plots?</p>