Can't pickle RendererAgg in tight_layout figures #1720

Closed
mspacek opened this Issue Jan 30, 2013 · 3 comments

Comments

Projects
None yet
3 participants
Contributor

mspacek commented Jan 30, 2013

Another pickling error. I use tight_layout() fairly extensively in my code. Running this:

from matplotlib.tests.test_pickle import recursive_pickle
f = figure()
plot(range(10))
f.tight_layout(pad=0.3)
recursive_pickle(f)

raises this:

<RendererAgg object at 0x3da7508>
Failed to pickle attribute "_renderer" in (attribute "_renderer" in (attribute "label" in
(list/tuple item #0 in (attribute "majorTicks" in (attribute "xaxis" in (list/tuple item #1
in (list/tuple item #1 in (list/tuple item #0 in (attribute "_elements" in (attribute
"_axstack" in (top level object))))))))))).
 Type: <type 'RendererAgg'>. Traceback follows:
---------------------------------------------------------------------------
UnpickleableError                         Traceback (most recent call last)
<ipython-input-1-34aaa9934d37> in <module>()
      3 plot(range(10))
      4 f.tight_layout(pad=1.0)
----> 5 recursive_pickle(f)

/home/mspacek/src/matplotlib/lib/matplotlib/tests/test_pickle.pyc in recursive_pickle(top_obj)
     88 #        print('trying %s' % location)
     89         try:
---> 90             pickle.dump(obj, BytesIO(), pickle.HIGHEST_PROTOCOL)
     91         except Exception, err:
     92             print(obj)

UnpickleableError: Cannot pickle <type 'RendererAgg'> objects

Again, maybe @pelson would would best able to investigate?

pelson was assigned Feb 4, 2013

Owner

mdboom commented May 20, 2013

This appears to be resolved in my own testing. @pelson: Do you agree?

Contributor

mspacek commented May 21, 2013

I agree. The code in the first post seems to now run without error.

Member

pelson commented May 21, 2013

😄

pelson closed this May 21, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment