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

How to change heatmap color

Hi all,

 

In my current script I have the individual sites defined as a certain color on the legend, but doing it like this won't carry over if the "sites" are labeled differently. I was thinking maybe "color cell" would be able to change all the cells to one color, but I'm having issues.

 

How would you script a single color for all the cells?

 

<gb=Graph Builder(
Size( 879, 653 ),
Show Control Panel( 0 ),
Variables( X( :SiteX ), Y( :SiteY ), Color( :Site ) ),
Elements( Heatmap( X, Y, Legend( 44 ), Label( "Label by Value" ), Color Theme("Solid","gray") ) ),
Local Data Filter( Close Outline( 1 ) ),
SendToReport(
Dispatch( {}, "SiteX", ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
Dispatch( {}, "SiteY", ScaleBox, {Label Row( Show Major Grid( 1 ) )} ),
Dispatch( {}, "400", ScaleBox,
{Legend Model(
44,
Properties( 0, {Fill Color( 32 )}, Item ID( "01", 1 ) ),
Properties( 1, {Fill Color( 32 )}, Item ID( "02", 1 ) ),
Properties( 2, {Fill Color( 32 )}, Item ID( "03", 1 ) ),
Properties( 3, {Fill Color( 32 )}, Item ID( "04", 1 ) ),
Properties( 4, {Fill Color( 32 )}, Item ID( "05", 1 ) ),
Properties( 5, {Fill Color( 32 )}, Item ID( "06", 1 ) ),
Properties( 6, {Fill Color( 32 )}, Item ID( "07", 1 ) )

.........>

4 REPLIES 4
jthi
Super User

Re: How to change heatmap color

Maybe you can use Value Colors column property on Site column?

jthi_1-1736272800902.png

Or do you wish to have same color for all sites? If that is the case you can create new column with just single value and use that as Color instead of Site column

-Jarmo
hogi
Level XII

Re: How to change heatmap color

If you want to use Color to get meaningful labels - but keep the color constant, you can use the legend server to batch assign a color to all entries:
A) via the GUI
select all entries and assign the color:

hogi_3-1736274061535.png

 


B) via JSL (version 1, tested with JMP17.2):

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );

gb=Graph Builder(

Variables( X( :height ), Y( :weight ), Color( :sex ) ),
Elements( Heatmap( X, Y )),
);


// talk to the legend server and batch assign a color
legend = gb << get legend server();
legenditems= (legend << get legend items)[1];
legenditems <<  set properties ({Fill Color( 1 )}) //bug in JMP 18  

 

hogi
Level XII

Re: How to change heatmap color

Due to a bug in JMP18, this approach doesn't work ...
B - version 2) As a workaround, you can talk with every entry individually and assign the color:
issue with get legend items 

 

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );

gb=Graph Builder(

Variables( X( :height ), Y( :weight ), Color( :sex ) ),
Elements( Heatmap( X, Y ,Label( "Label by Value" ))),
);


// talk to the legend server and batch assign a color
legend = gb << get legend server();
legenditems= (legend << get legend items)[1];


for(i=1, i<= Nitems(legenditems), i++, 
Eval(Eval Expr(item = legend  << Get Legend Item(1, Expr(i))));
	item <<  set properties ({Fill Color( 1 )})
);

 

hogi
Level XII

Re: How to change heatmap color

If you want to assign different colors to different entries, you can use value colors (as suggested by @jthi ) and apply a color theme:

hogi_1-1736273915473.png

 

or select all entries in the legend and assign a theme via the right click menu:

hogi_2-1736273964926.png