Skip to content

Commit 313813e

Browse files
committed
Use Bbox.unit() more.
1 parent fea21af commit 313813e

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

examples/text_labels_and_annotations/angle_annotation.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,7 @@ def get_size(self):
134134
if self.unit == "points":
135135
factor = self.ax.figure.dpi / 72.
136136
elif self.unit[:4] == "axes":
137-
b = TransformedBbox(Bbox.from_bounds(0, 0, 1, 1),
138-
self.ax.transAxes)
137+
b = TransformedBbox(Bbox.unit(), self.ax.transAxes)
139138
dic = {"max": max(b.width, b.height),
140139
"min": min(b.width, b.height),
141140
"width": b.width, "height": b.height}

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,7 @@ def apply_aspect(self, position=None):
18771877
return
18781878

18791879
trans = self.get_figure().transSubfigure
1880-
bb = mtransforms.Bbox.from_bounds(0, 0, 1, 1).transformed(trans)
1880+
bb = mtransforms.Bbox.unit().transformed(trans)
18811881
# this is the physical aspect of the panel (or figure):
18821882
fig_aspect = bb.height / bb.width
18831883

lib/matplotlib/axis.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,9 +2259,8 @@ def set_default_intervals(self):
22592259
self.stale = True
22602260

22612261
def get_tick_space(self):
2262-
ends = mtransforms.Bbox.from_bounds(0, 0, 1, 1)
2263-
ends = ends.transformed(self.axes.transAxes -
2264-
self.figure.dpi_scale_trans)
2262+
ends = mtransforms.Bbox.unit().transformed(
2263+
self.axes.transAxes - self.figure.dpi_scale_trans)
22652264
length = ends.width * 72
22662265
# There is a heuristic here that the aspect ratio of tick text
22672266
# is no more than 3:1
@@ -2521,9 +2520,8 @@ def set_default_intervals(self):
25212520
self.stale = True
25222521

25232522
def get_tick_space(self):
2524-
ends = mtransforms.Bbox.from_bounds(0, 0, 1, 1)
2525-
ends = ends.transformed(self.axes.transAxes -
2526-
self.figure.dpi_scale_trans)
2523+
ends = mtransforms.Bbox.unit().transformed(
2524+
self.axes.transAxes - self.figure.dpi_scale_trans)
25272525
length = ends.height * 72
25282526
# Having a spacing of at least 2 just looks good.
25292527
size = self._get_tick_label_size('y') * 2

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ def apply_aspect(self, position=None):
363363
# scales and box/datalim. Those are all irrelevant - all we need to do
364364
# is make sure our coordinate system is square.
365365
trans = self.get_figure().transSubfigure
366-
bb = mtransforms.Bbox.from_bounds(0, 0, 1, 1).transformed(trans)
366+
bb = mtransforms.Bbox.unit().transformed(trans)
367367
# this is the physical aspect of the panel (or figure):
368368
fig_aspect = bb.height / bb.width
369369

0 commit comments

Comments
 (0)