cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
See how to use JMP Live to centralize and share reports within groups. Webinar with Q&A April 4, 2pm ET.
Choose Language Hide Translation Bar
View Original Published Thread

RGB color by sript

Dennisbur
Level IV

Hello
I would like to color column "Name" and to use RGB
but recive mistake, what's wrong I did in this script?

 

dt = Current Data Table();

rows_to_color = dt << Get Rows Where (:"NAME" == :"NAME");
Column(dt, "NAME") << Color Cells (RGB ( 173, 255, 47 ), rows_to_color);

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User


Re: RGB color by sript

Yes you can. You can convert RGB colors to "JMP Colors" using RGB Color function. Below is an example

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

// lawngreen
Column(dt, "age") << Color Cells(RGB Color({124, 252, 0}/255));
-Jarmo

View solution in original post

5 REPLIES 5
jthi
Super User


Re: RGB color by sript

What are you trying to do with this comparison dt << Get Rows Where (:"NAME" == :"NAME")? Get list of all rows or something else? Also I don't think JMP has RGB named argument for Color Cells (you can get those colors, but it requires a bit more work)

https://www.jmp.com/support/help/en/17.2/#page/jmp/color-cells.shtml#ww725145

https://www.jmp.com/support/help/en/17.2/#page/jmp/graphics-functions.shtml?os=win&source=applicatio...

-Jarmo
Dennisbur
Level IV


Re: RGB color by sript

Hello

I mean, for example, I would like to paint the columns

and mostly, I use names of color like "Light Red"

for example, to color the column HOT

rows_to_color = dt << Get Rows Where(:"HOT" == :"HOT");

Column(dt, "HOT") << Color Cells("Light Red", rows_to_color);

Dennisbur_0-1712165571020.png

But I believe I can use more shades of color, maybe like RGB code?

jthi
Super User


Re: RGB color by sript

Yes you can. You can convert RGB colors to "JMP Colors" using RGB Color function. Below is an example

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

// lawngreen
Column(dt, "age") << Color Cells(RGB Color({124, 252, 0}/255));
-Jarmo
pmroz
Super User


Re: RGB color by sript

Rather than use "get rows where", might be easier to create a matrix of all row numbers.

dt = New Table( "Test Color", Add Rows( 5 ),
	New Column( "Column 1", Numeric, "Continuous", Format( "Best", 12 ),
		Set Values( [1, 2, 3, 4, 5] ) )
);
// Create a matrix of rows 1 to n
rows_to_color = 1::nrows(dt);
// Set the color
dt:Column 1 << color cells("Red", rows_to_color);

pmroz_0-1712168521459.png

 

Re: RGB color by sript

You can also supply a list of RGB values instead of a name or index value.

Column(dt, "age") << Color Cells( { 1, 1, 0.8 } );  // light yellow