Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RGBA values produce different result for imshow and for markers #7201

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

Closed
astrofrog opened this issue Sep 29, 2016 · 3 comments
Closed

RGBA values produce different result for imshow and for markers #7201

astrofrog opened this issue Sep 29, 2016 · 3 comments

Comments

@astrofrog
Copy link
Contributor

In the following example, I produce 9 colors ranging from completely transparent red to completely opaque red. In the case of imshow, the lighter colors actually end up being closer to gray, whereas for the scatter markers, the colors look as one would expect. What could be causing this?

import numpy as np
import matplotlib.pyplot as plt

data = np.arange(9, dtype=float).reshape((3, 3)) / 8.

color = np.array([1, 0, 0, 1], dtype=float)

array = color * np.ones(data.shape + (4,))
array[:, :, 3] *= data

fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
ax.imshow(array, vmin=0, vmax=1, interpolation='nearest')
for i in range(3):
    for j in range(3):
        ax.scatter(i, j, s=500, facecolor='white', edgecolor='white', alpha=1.0)
        ax.scatter(i, j, s=400, facecolor=array[j, i], edgecolor='white')
fig.savefig('colors.png')

colors

@QuLogic
Copy link
Member

QuLogic commented Sep 29, 2016

This works in 2.x as you'd expect:
colors

Not sure when it was fixed.

@QuLogic
Copy link
Member

QuLogic commented Sep 29, 2016

Maybe a dupe of #5949, but it's fixed by #5718.

@QuLogic QuLogic closed this as completed Sep 29, 2016
@QuLogic QuLogic added this to the 2.0 (style change major release) milestone Sep 29, 2016
@QuLogic
Copy link
Member

QuLogic commented Sep 30, 2016

Sorry, that first reference should be to #3343.

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