Skip to content

Commit 6378d48

Browse files
authored
Merge pull request matplotlib#27932 from anntzer/ads
Fix pickling of make_axes_area_auto_adjustable'd axes.
2 parents 98381ab + e694329 commit 6378d48

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

lib/matplotlib/tests/test_pickle.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import matplotlib.pyplot as plt
1616
import matplotlib.transforms as mtransforms
1717
import matplotlib.figure as mfigure
18-
from mpl_toolkits.axes_grid1 import parasite_axes # type: ignore
18+
from mpl_toolkits.axes_grid1 import axes_divider, parasite_axes # type: ignore
1919

2020

2121
def test_simple():
@@ -274,6 +274,7 @@ def test_unpickle_canvas():
274274

275275
def test_mpl_toolkits():
276276
ax = parasite_axes.host_axes([0, 0, 1, 1])
277+
axes_divider.make_axes_area_auto_adjustable(ax)
277278
assert type(pickle.loads(pickle.dumps(ax))) == parasite_axes.HostAxes
278279

279280

lib/mpl_toolkits/axes_grid1/axes_size.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,14 @@ class _AxesDecorationsSize(_Base):
233233
}
234234

235235
def __init__(self, ax, direction):
236-
self._get_size = _api.check_getitem(
237-
self._get_size_map, direction=direction)
236+
_api.check_in_list(self._get_size_map, direction=direction)
237+
self._direction = direction
238238
self._ax_list = [ax] if isinstance(ax, Axes) else ax
239239

240240
def get_size(self, renderer):
241241
sz = max([
242-
self._get_size(ax.get_tightbbox(renderer, call_axes_locator=False),
243-
ax.bbox)
242+
self._get_size_map[self._direction](
243+
ax.get_tightbbox(renderer, call_axes_locator=False), ax.bbox)
244244
for ax in self._ax_list])
245245
dpi = renderer.points_to_pixels(72)
246246
abs_size = sz / dpi

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy