cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
hogi
Level XIII

RBG Color in Graph Builder

I want to use a column in a Graph Builder plot to set the color in a heatmap—not with a color scale, but with an RGB value I previously extracted from an image.

Is there a possibility to store a RGB color in a column - and then use it in Graph Builder?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: RBG Color in Graph Builder

@hogi I should have read the entire question, thanks! 

For heatmaps, what about using the HLS color space instead of RGB? Since Hue kind of combines/codes for RGB data, you could use the Hue value in the Color role of a heat map, and a chromatic color scale. Color to HLS () in JSL would do the RGB to HLS conversion for you.

View solution in original post

9 REPLIES 9
hogi
Level XIII

Re: RBG Color in Graph Builder

if this is not possible, some workarounds :

  1. use value color,
    a) use value = row() - and use value color to map the rows to color
    b) save "color" with an encoding - and use value color to map the encoded color to the actual color

  2. is it possible to use the color from row state for a Heatmap Plot?
jthi
Super User

Re: RBG Color in Graph Builder

You can store the value as row state using Color State() and RGB Color(), but no idea about using that column directly in graph builder. 

 

-Jarmo
Victor_G
Super User

Re: RBG Color in Graph Builder

Hi @hogi,

I have used a previous solution from @txnelson that enable me to use HEX values from one column and get automatically row colors based on these values :

Return a JMP Color Value from a Hex Color Code 

For RGB values, there seems to be some solutions existing:

using RGB values in JSL scripts instead of color name or whatever this (--16741343) is 
Extracting colors from a #rrggbb column 


Hope these answers may help you,

Victor GUILLER

"It is not unusual for a well-designed experiment to analyze itself" (Box, Hunter and Hunter)
hogi
Level XIII

Re: RBG Color in Graph Builder

Hi  @Victor_G , thank you for the input.

HexColor is a nice option for:

hogi_0-1769878048996.png

the hard nut I still have to crack is how I can use this in Graph Builder / Heatmaps.
 
I'm leaning towards: save  {r, g,b } *255 as an expression - and using a table script to manually transfer the values to Value Colors .

another workaround: use  JSL & shape equation.
but Heatmaps has its benefits ...

Re: RBG Color in Graph Builder

Here's the script from the Image to Table extension to use an RGB value in Graph Builder. Since it uses JMP's built-in functions, it's fairly fast.

 

(dt << New Column( "Pixel Color", formula( Color State( RGB Color( :R, :G, :B ) ) ) )) << copy to row states;

 

hogi
Level XIII

Re: RBG Color in Graph Builder

Hi Jed Campbell , thank you for the code.

The hard nut I still have to crack is how I can use this in Graph Builder / Heatmaps.

Any better solution than the workaround via Value Colors?

hogi
Level XIII

Re: RBG Color in Graph Builder

possible application case: show me my life 
from: https://www.youtube.com/watch?v=arj7oStGLkU

empty plot:

hogi_0-1770045010224.png

Tim Urban knows that procrastination doesn't make sense, but he's never been able to shake his habit of waiting until the last minute to get things done. In this hilarious and insightful talk, Urban takes us on a journey through YouTube binges, Wikipedia rabbit holes and bouts of staring out the ...

Re: RBG Color in Graph Builder

@hogi I should have read the entire question, thanks! 

For heatmaps, what about using the HLS color space instead of RGB? Since Hue kind of combines/codes for RGB data, you could use the Hue value in the Color role of a heat map, and a chromatic color scale. Color to HLS () in JSL would do the RGB to HLS conversion for you.

hogi
Level XIII

Re: RBG Color in Graph Builder

Hue - a great idea to get very saturated colors!
In the new version, I apply a preselection based on L and S - and pick THE color by the dominant hue (mode()) .

This makes images with a lot of blue sky clearly visible as blue cells - like our trip to Greece in May 2024.
To get a nice contrast, days with missing image are grey ...

hogi_2-1770068048795.png

Recommended Articles