cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
lala
Level VII

How can set different cells to different colors

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

dt[1,1] is set to red
dt[1,2] is set to white
dt[1,1] is set to clear coloring

Thanks!

2 REPLIES 2
jthi
Super User

Re: How can set different cells to different colors

Use Color Cells

 

Scripting Index

jthi_0-1690356848176.png

 

-Jarmo
pmroz
Super User

Re: How can set different cells to different colors

One to do this is to set the colors of cells in your table manually.  Then look at the table script.  Right click on the red triangle next to the table name and select Copy table script:

pmroz_0-1690385386003.png

Here's the resulting code:

New Table( "Untitled 26", Add Rows( 3 ),
	New Column( "Column 1", Numeric, "Continuous",
		Format( "Best", 12 ),
		Color Cells( {{73, {1}}, {74, {2}}} ),
		Set Values( [1, 2, 3] )
	),
	New Column( "Column 2", Character, "Nominal",
		Color Cells( {{75, {2}}, {67, {3}}} ),
		Set Values( {"a", "b", "c"} )
	)
)