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

Appearance settings

Commit 9e7a235

Browse filesBrowse files
authored
Merge pull request #14745 from anntzer/scale
Replace Affine2D().scale(x, x) by Affine2D().scale(x).
2 parents a786753 + 6284adc commit 9e7a235
Copy full SHA for 9e7a235

File tree

Expand file treeCollapse file tree

8 files changed

+26
-26
lines changed
Filter options
Expand file treeCollapse file tree

8 files changed

+26
-26
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+8-6Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -568,13 +568,15 @@ def _get_text_path_transform(self, x, y, s, prop, angle, ismath):
568568
angle = np.deg2rad(angle)
569569
if self.flipy():
570570
width, height = self.get_canvas_width_height()
571-
transform = Affine2D().scale(fontsize / text2path.FONT_SCALE,
572-
fontsize / text2path.FONT_SCALE)
573-
transform = transform.rotate(angle).translate(x, height - y)
571+
transform = (Affine2D()
572+
.scale(fontsize / text2path.FONT_SCALE)
573+
.rotate(angle)
574+
.translate(x, height - y))
574575
else:
575-
transform = Affine2D().scale(fontsize / text2path.FONT_SCALE,
576-
fontsize / text2path.FONT_SCALE)
577-
transform = transform.rotate(angle).translate(x, y)
576+
transform = (Affine2D()
577+
.scale(fontsize / text2path.FONT_SCALE)
578+
.rotate(angle)
579+
.translate(x, y))
578580

579581
return path, transform
580582

‎lib/matplotlib/figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def __init__(self,
354354
f'{figsize}')
355355
self.bbox_inches = Bbox.from_bounds(0, 0, *figsize)
356356

357-
self.dpi_scale_trans = Affine2D().scale(dpi, dpi)
357+
self.dpi_scale_trans = Affine2D().scale(dpi)
358358
# do not use property as it will trigger
359359
self._dpi = dpi
360360
self.bbox = TransformedBbox(self.bbox_inches, self.dpi_scale_trans)
@@ -477,7 +477,7 @@ def _set_dpi(self, dpi, forward=True):
477477
Passed on to `~.Figure.set_size_inches`
478478
"""
479479
self._dpi = dpi
480-
self.dpi_scale_trans.clear().scale(dpi, dpi)
480+
self.dpi_scale_trans.clear().scale(dpi)
481481
w, h = self.get_size_inches()
482482
self.set_size_inches(w, h, forward=forward)
483483
self.callbacks.process('dpi_changed', self)
@@ -2391,8 +2391,7 @@ def get_tightbbox(self, renderer, bbox_extra_artists=None):
23912391

23922392
_bbox = Bbox.union(bb)
23932393

2394-
bbox_inches = TransformedBbox(_bbox,
2395-
Affine2D().scale(1. / self.dpi))
2394+
bbox_inches = TransformedBbox(_bbox, Affine2D().scale(1 / self.dpi))
23962395

23972396
return bbox_inches
23982397

‎lib/matplotlib/image.py

Copy file name to clipboardExpand all lines: lib/matplotlib/image.py
+3-4Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,9 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
335335
+ self.get_transform())
336336

337337
t = (t0
338-
+ Affine2D().translate(
339-
-clipped_bbox.x0,
340-
-clipped_bbox.y0)
341-
.scale(magnification, magnification))
338+
+ (Affine2D()
339+
.translate(-clipped_bbox.x0, -clipped_bbox.y0)
340+
.scale(magnification)))
342341

343342
# So that the image is aligned with the edge of the axes, we want to
344343
# round up the output width to the next integer. This also means

‎lib/matplotlib/markers.py

Copy file name to clipboardExpand all lines: lib/matplotlib/markers.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def _set_point(self):
452452
[Path.MOVETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY])
453453

454454
def _set_triangle(self, rot, skip):
455-
self._transform = Affine2D().scale(0.5, 0.5).rotate_deg(rot)
455+
self._transform = Affine2D().scale(0.5).rotate_deg(rot)
456456
self._snap_threshold = 5.0
457457
fs = self.get_fillstyle()
458458

‎lib/matplotlib/offsetbox.py

Copy file name to clipboardExpand all lines: lib/matplotlib/offsetbox.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ def draw(self, renderer):
763763

764764
dpi_cor = renderer.points_to_pixels(1.)
765765
self.dpi_transform.clear()
766-
self.dpi_transform.scale(dpi_cor, dpi_cor)
766+
self.dpi_transform.scale(dpi_cor)
767767

768768
# At this point the DrawingArea has a transform
769769
# to the display space so the path created is

‎lib/matplotlib/text.py

Copy file name to clipboardExpand all lines: lib/matplotlib/text.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,7 +1729,7 @@ def __call__(self, renderer):
17291729
raise RuntimeError("unknown type")
17301730

17311731
sc = self._get_scale(renderer)
1732-
tr = Affine2D().scale(sc, sc).translate(x, y)
1732+
tr = Affine2D().scale(sc).translate(x, y)
17331733

17341734
return tr
17351735

@@ -1822,13 +1822,13 @@ def _get_xy_transform(self, renderer, s):
18221822
if unit == "points":
18231823
# dots per points
18241824
dpp = self.figure.get_dpi() / 72.
1825-
tr = Affine2D().scale(dpp, dpp)
1825+
tr = Affine2D().scale(dpp)
18261826
elif unit == "pixels":
18271827
tr = Affine2D()
18281828
elif unit == "fontsize":
18291829
fontsize = self.get_size()
18301830
dpp = fontsize * self.figure.get_dpi() / 72.
1831-
tr = Affine2D().scale(dpp, dpp)
1831+
tr = Affine2D().scale(dpp)
18321832
elif unit == "fraction":
18331833
w, h = bbox0.bounds[2:]
18341834
tr = Affine2D().scale(w, h)

‎lib/matplotlib/textpath.py

Copy file name to clipboardExpand all lines: lib/matplotlib/textpath.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,9 @@ def _revalidate_path(self):
482482
`~.FONT_SCALE`, and this path is rescaled to other size when necessary.
483483
"""
484484
if self._invalid or self._cached_vertices is None:
485-
tr = Affine2D().scale(
486-
self._size / text_to_path.FONT_SCALE,
487-
self._size / text_to_path.FONT_SCALE).translate(*self._xy)
485+
tr = (Affine2D()
486+
.scale(self._size / text_to_path.FONT_SCALE)
487+
.translate(*self._xy))
488488
self._cached_vertices = tr.transform(self._vertices)
489489
self._invalid = False
490490

‎lib/mpl_toolkits/axisartist/axis_artist.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/axisartist/axis_artist.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ def draw(self, renderer):
265265
gc.set_alpha(self._alpha)
266266

267267
offset = renderer.points_to_pixels(size)
268-
marker_scale = Affine2D().scale(offset, offset)
268+
marker_scale = Affine2D().scale(offset)
269269

270270
if self.get_tick_out():
271271
add_angle = 180
@@ -276,7 +276,7 @@ def draw(self, renderer):
276276
marker_transform = marker_scale + marker_rotation
277277

278278
for loc, angle in self.locs_angles:
279-
marker_rotation.clear().rotate_deg(angle+add_angle)
279+
marker_rotation.clear().rotate_deg(angle + add_angle)
280280
locs = path_trans.transform_non_affine(np.array([loc]))
281281
if self.axes and not self.axes.viewLim.contains(*locs[0]):
282282
continue
@@ -1206,7 +1206,7 @@ def get_tightbbox(self, renderer):
12061206
self._axis_artist_helper.update_lim(self.axes)
12071207

12081208
dpi_cor = renderer.points_to_pixels(1.)
1209-
self.dpi_transform.clear().scale(dpi_cor, dpi_cor)
1209+
self.dpi_transform.clear().scale(dpi_cor)
12101210

12111211
self._update_ticks(renderer)
12121212
self._update_label(renderer)
@@ -1235,7 +1235,7 @@ def draw(self, renderer):
12351235
self._axis_artist_helper.update_lim(self.axes)
12361236

12371237
dpi_cor = renderer.points_to_pixels(1.)
1238-
self.dpi_transform.clear().scale(dpi_cor, dpi_cor)
1238+
self.dpi_transform.clear().scale(dpi_cor)
12391239

12401240
self._draw_ticks(renderer)
12411241
self._draw_line(renderer)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.