Confused about rgb_to_hsv and hsv_to_rgb

Hi Eric

If you look at the two attached images, both have the shading as expected,
but in one case the colours have changed, from the cubehelix colors, to
rainbow colors.

Yes, the result looks more like a rainbow set, but that doesn't mean anything is incorrect. The algorithm is doing what you are telling it to do. The "alter V" algorithm will *always* generate colors that are outside the original colormap. It happens that superimposing wild variations in V on something mapped with cubehelix yields a result that looks more rainbow-ish than if you started with some other map. This is just because of the character of cubehelix. It doesn't mean the code is failing--it means the algorithm is not the right one for the result you want to achieve, or cubehelix is not a good choice for the result you want, or both.

You might get something more to your liking if you were to start with a colormap in which V is uniform--all variation is in H and S--and then impose the shading on the V. Cubehelix starts with a full range of V, so replacing V with your shading channel completely changes the set of colors you end up with.

Eric

···

On 2015/05/23 8:49 AM, Matteo Niccoli wrote:

Matteo

On Sat, May 23, 2015 2:19 pm, Eric Firing wrote:

On 2015/05/22 9:33 AM, Matteo Niccoli wrote:

The second method suggested by titusjan replaces value in hsv space
with intensity as suggested. Eric you will notce I did include the line
  img_array = plt.get_cmap('cubehelix')(data_n) and yet the colormapping
is not working.

I don't understand your conclusion that the colormapping is not working.
I don't see anything wrong with any of these plots. The two
algorithms appear to be doing exactly what they are supposed to do.

Eric

-------------------------------------------------------------------------
-----
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Or maybe instead of replacing hsv[:,:,2] with dip you scale it by hsv[:,:,2]:

hsv[:,:,2]=dip*hsv[:,:,2]

Cheers, Jody

···

On May 23, 2015, at 12:07 PM, Eric Firing <efiring@...202...> wrote:

You might get something more to your liking if you were to start with a
colormap in which V is uniform--all variation is in H and S--and then
impose the shading on the V. Cubehelix starts with a full range of V,
so replacing V with your shading channel completely changes the set of
colors you end up with.

Nice idea
I will try

···

Sent from my iPhone

On May 23, 2015, at 2:23 PM, Jody Klymak <jklymak@...4192...> wrote:

On May 23, 2015, at 12:07 PM, Eric Firing <efiring@...202...> wrote:

You might get something more to your liking if you were to start with a
colormap in which V is uniform--all variation is in H and S--and then
impose the shading on the V. Cubehelix starts with a full range of V,
so replacing V with your shading channel completely changes the set of
colors you end up with.

Or maybe instead of replacing hsv[:,:,2] with dip you scale it by hsv[:,:,2]:

hsv[:,:,2]=dip*hsv[:,:,2]

Cheers, Jody

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users