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 9c4479a

Browse filesBrowse files
committed
Small simplifications to BboxImage.
self._transform/get_transform() can just be inherited from the base Artist class. A BboxTransform starting at the unit bbox is equivalent to BboxTransformTo.
1 parent ae47ad2 commit 9c4479a
Copy full SHA for 9c4479a

File tree

Expand file treeCollapse file tree

1 file changed

+4
-8
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-8
lines changed

‎lib/matplotlib/image.py

Copy file name to clipboardExpand all lines: lib/matplotlib/image.py
+4-8Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
# For user convenience, the names from _image are also imported into
2525
# the image namespace:
2626
from matplotlib._image import *
27-
from matplotlib.transforms import (Affine2D, BboxBase, Bbox, BboxTransform,
28-
IdentityTransform, TransformedBbox)
27+
from matplotlib.transforms import (
28+
Affine2D, BboxBase, Bbox, BboxTransform, BboxTransformTo,
29+
IdentityTransform, TransformedBbox)
2930

3031
_log = logging.getLogger(__name__)
3132

@@ -1377,12 +1378,7 @@ def __init__(self, bbox,
13771378
resample=resample,
13781379
**kwargs
13791380
)
1380-
13811381
self.bbox = bbox
1382-
self._transform = IdentityTransform()
1383-
1384-
def get_transform(self):
1385-
return self._transform
13861382

13871383
def get_window_extent(self, renderer=None):
13881384
if renderer is None:
@@ -1416,7 +1412,7 @@ def make_image(self, renderer, magnification=1.0, unsampled=False):
14161412
bbox_in._points /= [width, height]
14171413
bbox_out = self.get_window_extent(renderer)
14181414
clip = Bbox([[0, 0], [width, height]])
1419-
self._transform = BboxTransform(Bbox([[0, 0], [1, 1]]), clip)
1415+
self._transform = BboxTransformTo(clip)
14201416
return self._make_image(
14211417
self._A,
14221418
bbox_in, bbox_out, clip, magnification, unsampled=unsampled)

0 commit comments

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