Skip to content

Fix pickling of make_axes_area_auto_adjustable'd axes. #27932

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

Merged
merged 1 commit into from
Mar 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/matplotlib/tests/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import matplotlib.pyplot as plt
import matplotlib.transforms as mtransforms
import matplotlib.figure as mfigure
from mpl_toolkits.axes_grid1 import parasite_axes # type: ignore
from mpl_toolkits.axes_grid1 import axes_divider, parasite_axes # type: ignore


def test_simple():
Expand Down Expand Up @@ -274,6 +274,7 @@ def test_unpickle_canvas():

def test_mpl_toolkits():
ax = parasite_axes.host_axes([0, 0, 1, 1])
axes_divider.make_axes_area_auto_adjustable(ax)
assert type(pickle.loads(pickle.dumps(ax))) == parasite_axes.HostAxes


Expand Down
8 changes: 4 additions & 4 deletions lib/mpl_toolkits/axes_grid1/axes_size.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,14 @@ class _AxesDecorationsSize(_Base):
}

def __init__(self, ax, direction):
self._get_size = _api.check_getitem(
self._get_size_map, direction=direction)
_api.check_in_list(self._get_size_map, direction=direction)
self._direction = direction
self._ax_list = [ax] if isinstance(ax, Axes) else ax

def get_size(self, renderer):
sz = max([
self._get_size(ax.get_tightbbox(renderer, call_axes_locator=False),
ax.bbox)
self._get_size_map[self._direction](
ax.get_tightbbox(renderer, call_axes_locator=False), ax.bbox)
for ax in self._ax_list])
dpi = renderer.points_to_pixels(72)
abs_size = sz / dpi
Expand Down
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