KarlBlau <mai...@we...> writes:
> I would like to change the hue range of the hsv color map to use only hue
> values between 0 and 0.6667. I checked the documentation of matplotlib and
> searched in the internet but couldn't find the answer.
There doesn't seem to be any predefined functionality for this. The
easiest way to achieve this is probably just to take the definition of
hsv from _cm.py and modify it a little:
data = {'red': ((0., 1., 1.),(0.158730, 1.000000, 1.000000),
(0.174603, 0.968750, 0.968750),(0.333333, 0.031250, 0.031250),
(0.349206, 0.000000, 0.000000),(0.666667, 0.000000, 0.000000)),
'green': ((0., 0., 0.),(0.158730, 0.937500, 0.937500),
(0.174603, 1.000000, 1.000000),(0.507937, 1.000000, 1.000000),
(0.666667, 0.062500, 0.062500)),
'blue': ((0., 0., 0.),(0.333333, 0.000000, 0.000000),
(0.349206, 0.062500, 0.062500),(0.507937, 1.000000, 1.000000),
(0.666667, 1.000000, 1.000000))}
for k,v in data.items():
data[k] = [(a/0.666667, b, c) for (a,b,c) in v]
myhsv = matplotlib.colors.LinearSegmentedColormap('myhsv', data)
--
Jouni K. Seppänen
http://www.iki.fi/jks
|