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

Skip to content

Commit 6688af6

Browse files
committed
Merge remote-tracking branch 'matplotlib/v2.x'
2 parents f1bab50 + 76fd818 commit 6688af6

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

lib/matplotlib/cbook.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,13 @@ def issubclass_safe(x, klass):
14471447

14481448
def safe_masked_invalid(x, copy=False):
14491449
x = np.array(x, subok=True, copy=copy)
1450+
if not x.dtype.isnative:
1451+
# Note that the argument to `byteswap` is 'inplace',
1452+
# thus if we have already made a copy, do the byteswap in
1453+
# place, else make a copy with the byte order swapped.
1454+
# Be explicit that we are swapping the byte order of the dtype
1455+
x = x.byteswap(copy).newbyteorder('S')
1456+
14501457
try:
14511458
xm = np.ma.masked_invalid(x, copy=False)
14521459
xm.shrink_mask()

lib/matplotlib/tests/test_axes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4544,6 +4544,7 @@ def test_large_offset():
45444544
fig.canvas.draw()
45454545

45464546

4547+
@cleanup
45474548
def test_bar_color_cycle():
45484549
ccov = mcolors.colorConverter.to_rgb
45494550
fig, ax = plt.subplots()

lib/matplotlib/tests/test_image.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,21 @@ def test_mask_image():
737737
ax2.imshow(A, interpolation='nearest')
738738

739739

740-
if __name__=='__main__':
741-
import nose
742-
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
740+
@image_comparison(baseline_images=['imshow_endianess'],
741+
remove_text=True, extensions=['png'])
742+
def test_imshow_endianess():
743+
x = np.arange(10)
744+
X, Y = np.meshgrid(x, x)
745+
Z = ((X-5)**2 + (Y-5)**2)**0.5
746+
747+
fig, (ax1, ax2) = plt.subplots(1, 2)
748+
749+
kwargs = dict(origin="lower", interpolation='nearest',
750+
cmap='viridis')
751+
752+
ax1.imshow(Z.astype('<f8'), **kwargs)
753+
ax2.imshow(Z.astype('>f8'), **kwargs)
754+
755+
756+
if __name__ == '__main__':
757+
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)