diff --git a/lib/matplotlib/tests/baseline_images/test_image/image_interps.pdf b/lib/matplotlib/tests/baseline_images/test_image/image_interps.pdf index 42ea689625a3..eb482fed7fff 100644 Binary files a/lib/matplotlib/tests/baseline_images/test_image/image_interps.pdf and b/lib/matplotlib/tests/baseline_images/test_image/image_interps.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_image/interp_nearest_vs_none.pdf b/lib/matplotlib/tests/baseline_images/test_image/interp_nearest_vs_none.pdf new file mode 100644 index 000000000000..72148dd959e2 Binary files /dev/null and b/lib/matplotlib/tests/baseline_images/test_image/interp_nearest_vs_none.pdf differ diff --git a/lib/matplotlib/tests/baseline_images/test_image/interp_nearest_vs_none.svg b/lib/matplotlib/tests/baseline_images/test_image/interp_nearest_vs_none.svg new file mode 100644 index 000000000000..e80eb2436c91 --- /dev/null +++ b/lib/matplotlib/tests/baseline_images/test_image/interp_nearest_vs_none.svg @@ -0,0 +1,1061 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index 40bdab5709df..2c9db8a23e17 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -1,6 +1,7 @@ import numpy as np from matplotlib.testing.decorators import image_comparison, knownfailureif, cleanup +from matplotlib import rcParams import matplotlib.pyplot as plt from nose.tools import assert_raises from numpy.testing import assert_array_equal @@ -28,6 +29,25 @@ def test_image_interps(): ax3.imshow(X, interpolation='bicubic') ax3.set_ylabel('bicubic') +@image_comparison(baseline_images=['interp_nearest_vs_none'], extensions=['pdf', 'svg']) +def test_interp_nearest_vs_none(): + 'Test the effect of "nearest" and "none" interpolation' + # Setting dpi to something really small makes the difference very + # visible. This works fine with pdf, since the dpi setting doesn't + # affect anything but images, but the agg output becomes unusably + # small. + rcParams['savefig.dpi'] = 3 + X = np.array([[[218, 165, 32], [122, 103, 238]], + [[127, 255, 0], [255, 99, 71]]], dtype=np.uint8) + fig = plt.figure() + ax1 = fig.add_subplot(121) + ax1.imshow(X, interpolation='none') + ax1.set_title('interpolation none') + ax2 = fig.add_subplot(122) + ax2.imshow(X, interpolation='nearest') + ax2.set_title('interpolation nearest') + + @image_comparison(baseline_images=['figimage-0', 'figimage-1'], extensions=['png'], tol=1.5e-3) def test_figimage(): 'test the figimage method'