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

Cairo backend ignores alpha in imshow. #1193

Merged
merged 2 commits into from Jan 28, 2014

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Jan 27, 2014

As indicated in #1188 there is a problem with rendering images with alpha != 1 in the cairo backend.
The following code produces an image with alpha = 1 using the cairo backend
but the right alpha on the colorbar.

import matplotlib
matplotlib.use('cairo')
import numpy as np
import matplotlib.pyplot as plt

z = np.arange(150)
z.shape = (10,15)

fig, axs = plt.subplots(1,1)

ax = axs
im = ax.imshow(z, interpolation='nearest', alpha=0.3)
cbar = fig.colorbar(im, ax=ax)

plt.savefig("test2.png")
plt.savefig("test2.pdf")
plt.savefig("test2.svg")
plt.show()

@tacaswell
Copy link
Member

This is still a problem on master.

Tagged as 1.4, but it has sat for a year so can probably be pushed off if it is not simple to fix.

@mdboom
Copy link
Member

mdboom commented Jan 27, 2014

Sorry this has sat for so long. It turns out to be a very easy fix (attached).

pelson added a commit that referenced this pull request Jan 28, 2014
Cairo backend ignores alpha in imshow.
@pelson pelson merged commit 7887018 into matplotlib:master Jan 28, 2014
@pelson
Copy link
Member

pelson commented Jan 28, 2014

👍 LGMT

@mdboom mdboom deleted the cairo/alpha-handling branch August 7, 2014 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants