Closed
Description
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')