Dear all,
I am trying to create a colormap with a single color (red in the example below)
where the alpha varies from 0 to 1. It does look like I am getting some grayish
color near the low alpha values (around alpha = 0.2). Is that expected somehow?
The plot I get is here:
https://cloud.githubusercontent.com/assets/1680079/5084457/7d2d3790-6f06-11e4-9021-5b9e77e6a9c4.png
I am using matplotlib 1.4.2.
Here is a snippet which reproduces the issue.
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import LinearSegmentedColormap
import matplotlib
matplotlib.rcParams['figure.facecolor'] = 'white'
cm_dict = {'red': ((0.0, 1.0, 1.0),
(1.0, 1.0, 1.0)),
'green': ((0.0, 0.0, 0.0),
(1.0, 0.0, 0.0)),
'blue': ((0.0, 0.0, 0.0),
(1.0, 0.0, 0.0)),
'alpha': ((0.0, 0.0, 0.0),
(1.0, 1.0, 1.0))
}
my_cm = LinearSegmentedColormap('my_cm', cm_dict)
vals = np.tile(np.linspace(-1, 1, 30), (20, 1))
fig = plt.figure()
ax = plt.imshow(vals, cmap=my_cm)
plt.colorbar()
plt.show()
Cheers,
Loïc
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users