Skip to content

Cannot pickle a plot result if use tight_layout method (plot with datetime objects) #8273

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

Closed
bondarevts opened this issue Mar 12, 2017 · 2 comments
Milestone

Comments

@bondarevts
Copy link

Bug report

Bug summary

Cannot pickle a plot result if use tight_layout method on the plot with datetime objects.

Code for reproduction

import matplotlib.pyplot as plt
import pickle
from datetime import datetime

plot = plt.plot([datetime(1900, 1, 1), datetime(1900, 1, 2)], [1, 2])
plt.gcf().tight_layout()

dump = pickle.dumps(plot)
pickle.loads(dump)

Actual outcome

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/user/miniconda3/lib/python3.5/site-packages/matplotlib/dates.py", line 719, in __getattr__
    return getattr(self._rrule, name)

 ...

  File "/Users/user/miniconda3/lib/python3.5/site-packages/matplotlib/dates.py", line 719, in __getattr__
    return getattr(self._rrule, name)
RecursionError: maximum recursion depth exceeded while calling a Python object

Expected outcome

I expect to have a copy of the plot object.

Matplotlib version

matplotlib v.2.0.0 with Python 3.5.2 installed with conda on linux.

>>> import sys; print(sys.version)
3.5.2 |Continuum Analytics, Inc.| (default, Jul  2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)]
@anntzer
Copy link
Contributor

anntzer commented Mar 12, 2017

Looks like a duplicate of #7852 which is fixed by #7854.
ping @tacaswell whether to backport to 2.0.1 or not.

@dstansby
Copy link
Member

dstansby commented May 4, 2019

Seems to be working fine now.

@dstansby dstansby closed this as completed May 4, 2019
@dstansby dstansby added this to the v2.1 milestone May 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants