Skip to content

Commit cffe867

Browse files
committed
test_imgage_plot is now sensitive to the matplotlib.imshow origin parameter
1 parent 8eef445 commit cffe867

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

matplotlib2tikz/image.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def draw_image(data, obj):
2929

3030
if obj.origin == "lower":
3131
img_array = numpy.flipud(img_array)
32-
32+
3333
dims = img_array.shape
3434
if len(dims) == 2: # the values are given as one real number: look at cmap
3535
clims = obj.get_clim()
@@ -45,7 +45,6 @@ def draw_image(data, obj):
4545
# RGB (+alpha) information at each point
4646
assert len(dims) == 3 and dims[2] in [3, 4]
4747
# convert to PIL image
48-
4948
image = PIL.Image.fromarray(img_array)
5049
image.save(filename)
5150

test/test_image_plot.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@ def plot():
1414

1515
this_dir = os.path.dirname(os.path.realpath(__file__))
1616
lena = Image.open(os.path.join(this_dir, 'lena.png'))
17+
lena = lena.convert('L')
1718
dpi = rcParams['figure.dpi']
1819
figsize = lena.size[0]/dpi, lena.size[1]/dpi
1920
fig = pp.figure(figsize=figsize)
2021
ax = pp.axes([0, 0, 1, 1], frameon=False)
2122
ax.set_axis_off()
22-
pp.imshow(lena)
23+
pp.imshow(lena, cmap='viridis', origin='lower')
2324
# Set the current color map to HSV.
2425
pp.hsv()
2526
pp.colorbar()
2627
return fig
2728

2829

2930
def test():
30-
helpers.assert_phash(plot(), '75c3d34d1d0d4b91')
31+
helpers.assert_phash(plot(), '455361ec211d72fb')

0 commit comments

Comments
 (0)