Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2d2a126

Browse files
committed
Add unsampled kwarg everywhere
1 parent d21a6ed commit 2d2a126

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lib/matplotlib/image.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
369369

370370
return output, clipped_bbox.x0, clipped_bbox.y0, t
371371

372-
def make_image(self, renderer, magnification=1.0):
372+
def make_image(self, renderer, magnification=1.0, unsampled=False):
373373
raise RuntimeError('The make_image method must be overridden.')
374374

375375
def _draw_unsampled_image(self, renderer, gc):
@@ -715,10 +715,13 @@ def _check_unsampled_image(self, renderer):
715715
"""
716716
return False
717717

718-
def make_image(self, renderer, magnification=1.0):
718+
def make_image(self, renderer, magnification=1.0, unsampled=False):
719719
if self._A is None:
720720
raise RuntimeError('You must first set the image array')
721721

722+
if unsampled:
723+
raise ValueError('unsampled not supported on NonUniformImage')
724+
722725
A = self._A
723726
if A.ndim == 2:
724727
if A.dtype != np.uint8:
@@ -847,9 +850,11 @@ def __init__(self, ax,
847850
self.update(kwargs)
848851
self.set_data(x, y, A)
849852

850-
def make_image(self, renderer, magnification=1.0):
853+
def make_image(self, renderer, magnification=1.0, unsampled=False):
851854
if self._A is None:
852855
raise RuntimeError('You must first set the image array')
856+
if unsampled:
857+
raise ValueError('unsampled not supported on PColorImage')
853858
fc = self.axes.patch.get_facecolor()
854859
bg = mcolors.colorConverter.to_rgba(fc, 0)
855860
bg = (np.array(bg)*255).astype(np.uint8)

0 commit comments

Comments
 (0)