Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Closed
@astrofrog

Description

@astrofrog
Issue body actions

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.