Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Can't pickle bar plots: Failed to pickle attribute "gridline" #1719

Closed
Assignees
pelson
@mspacek

Description

@mspacek

I know pickling of figures (awesome!) is still experimental, but it seems bar plots have problems.recursive_pickle() seems to give a more detailed traceback thanpickle.dump():

from matplotlib.tests.test_pickle import recursive_picklefrom pylab import figure, barfig = figure()bar(left=range(10), height=range(10))recursive_pickle(fig)

gives:

Line2D((0,0),(0,1))Failed to pickle attribute "gridline" 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: <class 'matplotlib.lines.Line2D'>. Traceback follows:---------------------------------------------------------------------------TypeError                                 Traceback (most recent call last)<ipython-input-9-b0c9db9f3303> in <module>()----> 1 recursive_pickle(fig)/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)TypeError: expected string or Unicode object, NoneType found

Usingpickle.dump() instead like this:

import picklefrom io import BytesIOfrom pylab import figure, barfig = figure()bar(left=range(10), height=range(10))pickle.dump(fig, BytesIO(), pickle.HIGHEST_PROTOCOL)

gives a different error:

PicklingError: Can't pickle <built-in method copy_from_bbox of tuple object at 0x3406a70>:it's not found as __main__.copy_from_bbox

This is in master on Python 2.7 on Ubuntu 12.10.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp