Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdf backend not outputting masks for grayscale images #4331

Closed
jkseppan opened this issue Apr 13, 2015 · 0 comments
Closed

pdf backend not outputting masks for grayscale images #4331

jkseppan opened this issue Apr 13, 2015 · 0 comments
Assignees

Comments

@jkseppan
Copy link
Member

Reported in http://thread.gmane.org/gmane.comp.python.matplotlib.general/35473/

@tacaswell provided this example where you get artifacts in the pdf output:

x, y = np.ogrid[-5:5:.1, -5:5:.1]
dd = np.exp(-(x**2 + y**2))
dd[dd < .1] = np.nan

fig, ax = plt.subplots()
ax.imshow(dd, interpolation='none', cmap='gray_r')
plt.savefig('test.pdf')

If you change the colormap to e.g. 'Greens' the artifacts go away. I think this is because of the asymmetry in PdfFile.writeImages: grayscale images don't get an smask object while rgb images do.

jkseppan added a commit to jkseppan/matplotlib that referenced this issue Jul 6, 2015
The code was conflating the presence of an alpha channel with whether
the image is grayscale or RGB.

Fixes matplotlib#4331
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants