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

Commit062d54a

Browse files
committed
Text should take up a pixel of window extent when invisible
1 parent10a0c8f commit062d54a

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

‎lib/matplotlib/text.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ def get_window_extent(self, renderer=None, dpi=None):
874874
"""
875875
#return _unit_box
876876
ifnotself.get_visible():
877-
returnBbox.null()
877+
returnBbox.unit()
878878
ifdpiisNone:
879879
dpi=self.figure.dpi
880880
ifself.get_text()=='':
@@ -1959,7 +1959,7 @@ def get_window_extent(self, renderer=None):
19591959
# This block is the same as in Text.get_window_extent, but we need to
19601960
# set the renderer before calling update_positions().
19611961
ifnotself.get_visible()ornotself._check_xy(renderer):
1962-
returnBbox.null()
1962+
returnBbox.unit()
19631963
ifrendererisnotNone:
19641964
self._renderer=renderer
19651965
ifself._rendererisNone:
@@ -1977,5 +1977,11 @@ def get_window_extent(self, renderer=None):
19771977

19781978
returnBbox.union(bboxes)
19791979

1980+
defget_tightbbox(self,renderer):
1981+
# docstring inherited
1982+
ifnotself._check_xy(renderer):
1983+
returnBbox.null()
1984+
returnsuper().get_tightbbox(renderer)
1985+
19801986

19811987
docstring.interpd.update(Annotation=Annotation.__init__.__doc__)

‎lib/matplotlib/tight_layout.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,8 @@ def auto_adjust_subplotpars(
6868

6969
ifax_bbox_listisNone:
7070
ax_bbox_list= [
71-
[ax.get_position(original=True)foraxinsubplots]
72-
forsubplotsinsubplot_list
73-
]
74-
ax_bbox_list= [
75-
Bbox.union([
76-
bforbinbbox_list
77-
ifnp.isfinite(b.width)andnp.isfinite(b.height)
78-
and (b.width!=0orb.height!=0)
79-
])
80-
forbbox_listinax_bbox_list
81-
]
71+
Bbox.union([ax.get_position(original=True)foraxinsubplots])
72+
forsubplotsinsubplot_list]
8273

8374
forsubplots,ax_bbox, (num1,num2)inzip(subplot_list,
8475
ax_bbox_list,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp