Elffuss BraidHub

kikocis/auto-code-rover public

main · 1004 BRawPermalink
1[Bug]: Unable to pickle figure with aligned labels
2### Bug summary
3
4 Unable to pickle figure after calling `align_labels()`
5
6### Code for reproduction
7
8```python
9import matplotlib.pyplot as plt
10import pickle
11
12fig = plt.figure()
13ax1 = fig.add_subplot(211)
14ax2 = fig.add_subplot(212)
15time=[0,1,2,3,4]
16speed=[40000,4300,4500,4700,4800]
17acc=[10,11,12,13,14]
18ax1.plot(time,speed)
19ax1.set_ylabel('speed')
20ax2.plot(time,acc)
21ax2.set_ylabel('acc')
22
23fig.align_labels() ##pickling works after removing this line
24
25pickle.dumps(fig)
26plt.show()
27```
28
29
30### Actual outcome
31```
32align.py", line 16
33pickle.dumps(fig)
34TypeError: cannot pickle 'weakref.ReferenceType' object
35```
36### Expected outcome
37
38Pickling successful
39
40### Additional information
41
42_No response_
43
44### Operating system
45
46Windows
47
48### Matplotlib Version
49
503.7.0
51
52### Matplotlib Backend
53
54_No response_
55
56### Python version
57
58_No response_
59
60### Jupyter version
61
62_No response_
63
64### Installation
65
66None