Skip to content

Can't pickle RendererAgg in tight_layout figures #1720

@mspacek

Description

@mspacek

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?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions