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

Skip to content

Commit d6b22a5

Browse files
committed
Address more minor comments in the PR
1 parent bd521cd commit d6b22a5

File tree

6 files changed

+7
-11
lines changed

6 files changed

+7
-11
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ def _unpack(self, im):
12591259
"""
12601260
h, w = im.shape[:2]
12611261
im = im[::-1]
1262-
if len(im.shape) == 2:
1262+
if im.ndim == 2:
12631263
return h, w, im, None
12641264
else:
12651265
rgb = im[:, :, :3]

lib/matplotlib/backends/backend_svg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ def draw_image(self, gc, x, y, im, transform=None):
842842

843843
self.writer.element(
844844
'image',
845-
transform = generate_transform([
845+
transform=generate_transform([
846846
('scale', (1, -1)), ('translate', (0, -h))]),
847847
x=short_float_fmt(x),
848848
y=short_float_fmt(-(self.height - y - h)),

lib/matplotlib/backends/backend_wx.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def draw_image(self, gc, x, y, im):
281281
w = self.width
282282
h = self.height
283283
rows, cols = im.shape[:2]
284-
bitmap = wxc.BitmapFromBuffer(cols, rows, im.tobytes())
284+
bitmap = wxc.BitmapFromBuffer(cols, rows, im.tostring())
285285
gc = self.get_gc()
286286
gc.select()
287287
gc.gfx_ctx.DrawBitmap(bitmap, int(l), int(self.height - b),

lib/matplotlib/image.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,9 @@ def _draw_list_compositing_images(
127127
between `Figure.draw` and `Axes.draw`, but otherwise should not be
128128
generally useful.
129129
"""
130-
has_images = np.any(isinstance(x[1], _ImageBase) for x in dsu)
130+
has_images = any(isinstance(x[1], _ImageBase) for x in dsu)
131131

132-
# override the renderer default if self.suppressComposite
133-
# is not None
132+
# override the renderer default if suppressComposite is not None
134133
not_composite = renderer.option_image_nocomposite()
135134
if suppress_composite is not None:
136135
not_composite = suppress_composite
@@ -277,7 +276,7 @@ def changed(self):
277276
def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
278277
unsampled=False, round_to_pixel_border=True):
279278
"""
280-
Normalize, rescale and color the image `A` to the given
279+
Normalize, rescale and color the image `A` from the given
281280
in_bbox (in data space), to the given out_bbox (in pixel
282281
space) clipped to the given clip_bbox (also in pixel space),
283282
and magnified by the magnification factor.

lib/matplotlib/tests/test_agg.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@ def test_long_path():
163163
extensions=['png'], remove_text=True)
164164
def test_agg_filter():
165165
def smooth1d(x, window_len):
166-
# copied from http://www.scipy.org/Cookbook/SignalSmooth
167-
168166
s = np.r_[2*x[0] - x[window_len:1:-1],
169167
x,
170168
2*x[-1] - x[-1:-window_len:-1]]
@@ -229,7 +227,6 @@ def get_pad(self, dpi):
229227
return int(self.sigma*3/72.*dpi)
230228

231229
def process_image(self, padded_src, dpi):
232-
#offsetx, offsety = int(self.offsets[0]), int(self.offsets[1])
233230
tgt_image = np.zeros_like(padded_src)
234231
aa = smooth2d(padded_src[:, :, -1]*self.alpha,
235232
self.sigma/72.*dpi)

lib/matplotlib/tests/test_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ def test_log_scale_image():
560560
ax = fig.add_subplot(111)
561561

562562
ax.imshow(Z, extent=[1, 100, 1, 100], cmap='viridis',
563-
vmax=abs(Z).max(), vmin=-abs(Z).max())
563+
vmax=1, vmin=-1)
564564
ax.set_yscale('log')
565565

566566

0 commit comments

Comments
 (0)