Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix for unpickling polar plot issue #4068 #4264

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 25, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions lib/matplotlib/projections/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ def get_matrix(self):
return self._mtx
get_matrix.__doc__ = Affine2DBase.get_matrix.__doc__

def __getstate__(self):
return {}


class InvertedPolarTransform(Transform):
"""
Expand Down
15 changes: 15 additions & 0 deletions lib/matplotlib/tests/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def test_simple():
pickle.dump(fig, BytesIO(), pickle.HIGHEST_PROTOCOL)


@cleanup
@image_comparison(baseline_images=['multi_pickle'],
extensions=['png'], remove_text=True)
def test_complete():
Expand Down Expand Up @@ -194,6 +195,7 @@ def test_complete():
assert_equal(fig.get_label(), 'Figure with a label?')


@cleanup
def test_no_pyplot():
# tests pickle-ability of a figure not created with pyplot
from matplotlib.backends.backend_pdf import FigureCanvasPdf as fc
Expand All @@ -206,12 +208,14 @@ def test_no_pyplot():
pickle.dump(fig, BytesIO(), pickle.HIGHEST_PROTOCOL)


@cleanup
def test_renderer():
from matplotlib.backends.backend_agg import RendererAgg
renderer = RendererAgg(10, 20, 30)
pickle.dump(renderer, BytesIO())


@cleanup
def test_image():
# Prior to v1.4.0 the Image would cache data which was not picklable
# once it had been drawn.
Expand All @@ -224,6 +228,7 @@ def test_image():
pickle.dump(fig, BytesIO())


@cleanup
def test_grid():
from matplotlib.backends.backend_agg import new_figure_manager
manager = new_figure_manager(1000)
Expand All @@ -237,6 +242,16 @@ def test_grid():
pickle.dump(ax, BytesIO())


@cleanup
def test_polar():
ax = plt.subplot(111, polar=True)
fig = plt.gcf()
result = BytesIO()
pf = pickle.dumps(fig)
pickle.loads(pf)
plt.draw()


if __name__ == '__main__':
import nose
nose.runmodule(argv=['-s'])