Elffuss BraidHub

kikocis/auto-code-rover public

main · 908 BRawPermalink
1[Bug]: Unable to pickle figure with draggable legend
2### Bug summary
3
4I am unable to pickle figure with draggable legend. Same error comes for draggable annotations.
5
6
7
8
9
10### Code for reproduction
11
12```python
13import matplotlib.pyplot as plt
14import pickle
15
16fig = plt.figure()
17ax = fig.add_subplot(111)
18
19time=[0,1,2,3,4]
20speed=[40,43,45,47,48]
21
22ax.plot(time,speed,label="speed")
23
24leg=ax.legend()
25leg.set_draggable(True) #pickling works after removing this line
26
27pickle.dumps(fig)
28plt.show()
29```
30
31
32### Actual outcome
33
34`TypeError: cannot pickle 'FigureCanvasQTAgg' object`
35
36### Expected outcome
37
38Pickling successful
39
40### Additional information
41
42_No response_
43
44### Operating system
45
46Windows 10
47
48### Matplotlib Version
49
503.7.0
51
52### Matplotlib Backend
53
54_No response_
55
56### Python version
57
583.10
59
60### Jupyter version
61
62_No response_
63
64### Installation
65
66pip