cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Dennisbur
Level IV

RGB color by sript

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