cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
lala
Level IX

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"} )
	)
)

Recommended Articles