FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Get correct renderer for axes_grid1 inset axes with bbox_inches=tight by ksunden · Pull Request #26291 · matplotlib/matplotlib · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 2 additions & 0 deletions lib/mpl_toolkits/axes_grid1/inset_locator.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ def draw(self, renderer):
raise RuntimeError("No draw method should be called")

def __call__(self, ax, renderer):
if renderer is None:
renderer = ax.figure._get_renderer()
self.axes = ax
bbox = self.get_window_extent(renderer)
px, py = self.get_offset(bbox.width, bbox.height, 0, 0, renderer)
Expand Down
10 changes: 10 additions & 0 deletions lib/mpl_toolkits/axes_grid1/tests/test_axes_grid1.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from itertools import product
import io
import platform

import matplotlib as mpl
Expand Down Expand Up @@ -247,6 +248,15 @@ def test_inset_axes_complete():
bbox_transform=ax.transAxes)


def test_inset_axes_tight():
# gh-26287 found that inset_axes raised with bbox_inches=tight
fig, ax = plt.subplots()
inset_axes(ax, width=1.3, height=0.9)

f = io.BytesIO()
fig.savefig(f, bbox_inches="tight")


@image_comparison(['fill_facecolor.png'], remove_text=True, style='mpl20')
def test_fill_facecolor():
fig, ax = plt.subplots(1, 5)
Expand Down

Back | FazBrowse Home | New Git URL