Commit 6d79e6e
committed
Fix interaction with unpickled 3d plots.
In order to reset the mouse interaction callbacks on unpickled 3d plots,
the callback registry really needs to be on the Figure object rather
than the Canvas, because the canvas doesn't exist yet when the 3d axes
is being unpickled (it is only set on the figure at the very end of
unpickling).
So move the callback registry to the figure (with a proxy property on
the canvas).
Then, add a private mechanism to pickle select callbacks, and combine
everything together.
Test with e.g.
```
import matplotlib.pyplot as plt
import pickle
fig = plt.figure()
fig.add_subplot(111, projection='3d')
p = pickle.dumps(fig)
plt.close("all")
pickle.loads(p)
plt.show()
```1 parent 74d6145 commit 6d79e6e
File tree
4 files changed
+49
-15
lines changed- lib
- matplotlib
- cbook
- mpl_toolkits/mplot3d
4 files changed
+49
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1718 | 1718 | | |
1719 | 1719 | | |
1720 | 1720 | | |
1721 | | - | |
1722 | | - | |
1723 | 1721 | | |
1724 | 1722 | | |
1725 | 1723 | | |
| |||
1730 | 1728 | | |
1731 | 1729 | | |
1732 | 1730 | | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
1733 | 1735 | | |
1734 | 1736 | | |
1735 | 1737 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
107 | 117 | | |
108 | 118 | | |
109 | 119 | | |
| |||
163 | 173 | | |
164 | 174 | | |
165 | 175 | | |
| 176 | + | |
| 177 | + | |
166 | 178 | | |
167 | 179 | | |
168 | | - | |
169 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
170 | 200 | | |
171 | 201 | | |
172 | 202 | | |
173 | 203 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 204 | + | |
178 | 205 | | |
179 | 206 | | |
180 | | - | |
181 | 207 | | |
182 | 208 | | |
183 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2280 | 2280 | | |
2281 | 2281 | | |
2282 | 2282 | | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
2283 | 2287 | | |
2284 | 2288 | | |
2285 | 2289 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
127 | 129 | | |
128 | 130 | | |
129 | 131 | | |
| |||
0 commit comments