Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix tight-bbox computation of HostAxes.#30099

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
QuLogic merged 1 commit intomatplotlib:mainfromanntzer:hatb
May 30, 2025
Merged
Show file tree
Hide file tree
Changes fromall 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: 3 additions & 0 deletionslib/mpl_toolkits/axes_grid1/parasite_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,6 +25,9 @@ def clear(self):
self._parent_axes.callbacks._connect_picklable(
"ylim_changed", self._sync_lims)

def get_axes_locator(self):
return self._parent_axes.get_axes_locator()

def pick(self, mouseevent):
# This most likely goes to Artist.pick (depending on axes_class given
# to the factory), which only handles pick events registered on the
Expand Down
23 changes: 22 additions & 1 deletionlib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@
from matplotlib.backend_bases import MouseEvent
from matplotlib.colors import LogNorm
from matplotlib.patches import Circle, Ellipse
from matplotlib.transforms import Bbox, TransformedBbox
from matplotlib.transforms importAffine2D,Bbox, TransformedBbox
from matplotlib.testing.decorators import (
check_figures_equal, image_comparison, remove_ticks_and_titles)

Expand All@@ -26,6 +26,7 @@
from mpl_toolkits.axes_grid1.axes_rgb import RGBAxes
from mpl_toolkits.axes_grid1.inset_locator import (
zoomed_inset_axes, mark_inset, inset_axes, BboxConnectorPatch)
from mpl_toolkits.axes_grid1.parasite_axes import HostAxes
import mpl_toolkits.axes_grid1.mpl_axes
import pytest

Expand DownExpand Up@@ -467,6 +468,26 @@ def test_gettightbbox():
[-17.7, -13.9, 7.2, 5.4])


def test_gettightbbox_parasite():
fig = plt.figure()

y0 = 0.3
horiz = [Size.Scaled(1.0)]
vert = [Size.Scaled(1.0)]
ax0_div = Divider(fig, [0.1, y0, 0.8, 0.2], horiz, vert)
ax1_div = Divider(fig, [0.1, 0.5, 0.8, 0.4], horiz, vert)

ax0 = fig.add_subplot(
xticks=[], yticks=[], axes_locator=ax0_div.new_locator(nx=0, ny=0))
ax1 = fig.add_subplot(
axes_class=HostAxes, axes_locator=ax1_div.new_locator(nx=0, ny=0))
aux_ax = ax1.get_aux_axes(Affine2D())

fig.canvas.draw()
rdr = fig.canvas.get_renderer()
assert rdr.get_canvas_width_height()[1] * y0 / fig.dpi == fig.get_tightbbox(rdr).y0


@pytest.mark.parametrize("click_on", ["big", "small"])
@pytest.mark.parametrize("big_on_axes,small_on_axes", [
("gca", "gca"),
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp