Skip to content

Cairo backend ignores alpha in imshow. - #1193

Merged
pelson merged 2 commits into
matplotlib:masterfrom
mdboom:cairo/alpha-handling
Jan 28, 2014
Merged

pelson merged 2 commits into
matplotlib:masterfrom
mdboom:cairo/alpha-handling

Conversation

@mdboom

@mdboom mdboom commented Jan 27, 2014

Copy link
Copy Markdown
Member

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
Copy Markdown
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

mdboom commented Jan 27, 2014

Copy link
Copy Markdown
Member

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

pelson commented Jan 28, 2014

Copy link
Copy Markdown
Member

👍 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.

4 participants