On Tue, Mar 22, 2011 at 3:58 PM, Paul Ivanov <pivanov...@gmail.com> wrote:
> Hey everyone,
>
> Michael D and I are working on reducing the memory footprint of
> our test suite here at Sage days (we've made very good progress!),
> and came across a behavior of plt.clf() that we wanted feedback
> on.
>
> At the moment, plt.clf (i.e. fig.clf) do not clear all of the
> state variable associated with a figure. I think the most
> consistent thing to do is to have a clf() change the figure to be
> the same as a freshly created plt.figure(), but this is not the
> case. For example:
>
> In [5]: f = plt.figure()
>
> In [6]: f.subplotpars.left
> Out[6]: 0.055
>
> In [7]: f.subplotpars.left = .20
>
> In [8]: f.clf()
>
> In [9]: f.subplotpars.left
> Out[9]: 0.20000000000000001
>
> I propose making clf revert all variables back to their rcParams
> defaults (i.e. make it so that Out[9]: 0.055), and possibly
> creating a new rcParam to allow individuals to preserve the old
> behavior (in case people have code which relies on it, and prefer
> it to stay the same). Additionally, we could have an optional
> bolean parameter to clf, called 'scrub' or 'fresh' or something like
> that, which would implement the rcParam specified behavior by
> default, but allow users to scrub or not scrub on a call by call
> basis.
>
> Does anyone have any thoughts about this?
>
>
My feeling is that it should retain some properties such as the figure
size. Imagine a case where one would be creating figures for saving that is
made of multiple subplots:
fig = plt.figure(figsize=plt.figaspect(0.5))
for index, data in enumerate(datas) :
ax = fig.add_subplot(1, 2, 1)
ax.plot(data[0])
ax = fig.add_subplot(1, 2, 2)
ax.plot(data[1])
fig.savefig("foo%d.png" % index)
fig.clf()
In this case, I think it would be reasonable to expect that the figure
retains its size. Then again, maybe I am doing it wrong...
Just my 2 cents.
Ben Root
------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software
be a part of the solution? Download the Intel(R) Manageability Checker
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel