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
OleksandrG
Level II

Heatmap overlay from multiple variables

I collect a response from MxN sensor. The data comes as a table with multiple variables stored in individual columns ParamA, ParamB, ParamC.

TLDR: I want to obtain two heatmaps on the right in the sketch below.

JMP heatmap overlay example.png

 

In the first application, I would like to plot a heatmap resulting from an overlay of two logical variables, i.e. ParamA=1 as Blue, ParamB=1 as Red, ParamA=1&ParamB=1 as Magenta.

 

In the second application, I would like to overlay a heatmap of continuous variable ParamC (as Fill Color) with heatmap of logical variable ParamA (as Fill Pattern).

 

I would prefer to avoid calculating a separate column for these maps since actual data has dozens of variables resulting in too many permutations. Ideally I would like to use a solution from Graph Builder, without scripting.

I use JMP 18.1.1.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Heatmap overlay from multiple variables

My suggestion is to overlay two Heatmaps in the Graph Builder window.  

Select both columns you wish to color by, and drag them to the color role. For example: 

christianz_0-1751010835854.png

Next, right-click anywhere within the Heatmap graph and select Add > Heatmap. Now you have two duplicate heatmaps, each with both Params in the color role. Under Variables, de-select one Param in each Heatmap's Color assignment, so that each Heatmap is colored according to that Param only. For example:

christianz_1-1751011155023.png

Finally, change each Param's color or pattern encoding as desired. Note that the heatmap at the bottom of this list will be on top on the graphic. (Note: With no scripting, I think only 2 Params can be overlaid - but if you edit the script, you can add all 3 and generalize this method to overlay more than two Heatmaps.) 

Here's a script for example 1: 

View more...

 

Graph Builder(
	Size( 518, 448 ),
	Show Control Panel( 0 ),
	Variables( X( :col ), Y( :row ), Color( :ParamA ), Color( :ParamB ) ),
	Elements(
		Heatmap( X, Y, Color( 2 ), Legend( 5 ) ),
		Heatmap( X, Y, Color( 1 ), Legend( 6 ) )
	),
	SendToReport(
		Dispatch( {}, "400", ScaleBox,
			{Legend Model(
				5,
				Properties( 0, {Transparency( 0 )}, Item ID( "0", 1 ) ),
				Properties( 1, {Transparency( 0.5 )}, Item ID( "1", 1 ) )
			), Legend Model(
				6,
				Properties( 0, {Transparency( 0 )}, Item ID( "0", 1 ) ),
				Properties( 1, {Transparency( 0.5 )}, Item ID( "1", 1 ) )
			)}
		)
	)
);

 

Here's a script for example 2: 

View more...

 

Graph Builder(
	Size( 518, 448 ),
	Show Control Panel( 0 ),
	Variables( X( :col ), Y( :row ), Color( :ParamC ), Color( :ParamA ) ),
	Elements(
		Heatmap( X, Y, Color( 1 ), Legend( 14 ) ),
		Heatmap( X, Y, Color( 2 ), Legend( 15 ) )
	),
	SendToReport(
		Dispatch( {}, "400", ScaleBox,
			{Legend Model(
				15,
				Properties( 0, {Transparency( 0 )}, Item ID( "0", 1 ) ),
				Properties(
					1,
					{Fill Color( 0 ), Fill Pattern( "triangle up" )},
					Item ID( "1", 1 )
				),
				Properties(
					-1,
					{Fill Color( 0 ), Fill Pattern( "triangle left" )},
					Item ID( "-1", 1 )
				)
			)}
		)
	)
);

 

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: Heatmap overlay from multiple variables

I believe the 2 options you have, are to create the data in data table manipulation and then display with Graph Builder, or to use JSL's graphic functions to build your own display in a Graph box() that creates the results you need.

Jim

Re: Heatmap overlay from multiple variables

My suggestion is to overlay two Heatmaps in the Graph Builder window.  

Select both columns you wish to color by, and drag them to the color role. For example: 

christianz_0-1751010835854.png

Next, right-click anywhere within the Heatmap graph and select Add > Heatmap. Now you have two duplicate heatmaps, each with both Params in the color role. Under Variables, de-select one Param in each Heatmap's Color assignment, so that each Heatmap is colored according to that Param only. For example:

christianz_1-1751011155023.png

Finally, change each Param's color or pattern encoding as desired. Note that the heatmap at the bottom of this list will be on top on the graphic. (Note: With no scripting, I think only 2 Params can be overlaid - but if you edit the script, you can add all 3 and generalize this method to overlay more than two Heatmaps.) 

Here's a script for example 1: 

View more...

 

Graph Builder(
	Size( 518, 448 ),
	Show Control Panel( 0 ),
	Variables( X( :col ), Y( :row ), Color( :ParamA ), Color( :ParamB ) ),
	Elements(
		Heatmap( X, Y, Color( 2 ), Legend( 5 ) ),
		Heatmap( X, Y, Color( 1 ), Legend( 6 ) )
	),
	SendToReport(
		Dispatch( {}, "400", ScaleBox,
			{Legend Model(
				5,
				Properties( 0, {Transparency( 0 )}, Item ID( "0", 1 ) ),
				Properties( 1, {Transparency( 0.5 )}, Item ID( "1", 1 ) )
			), Legend Model(
				6,
				Properties( 0, {Transparency( 0 )}, Item ID( "0", 1 ) ),
				Properties( 1, {Transparency( 0.5 )}, Item ID( "1", 1 ) )
			)}
		)
	)
);

 

Here's a script for example 2: 

View more...

 

Graph Builder(
	Size( 518, 448 ),
	Show Control Panel( 0 ),
	Variables( X( :col ), Y( :row ), Color( :ParamC ), Color( :ParamA ) ),
	Elements(
		Heatmap( X, Y, Color( 1 ), Legend( 14 ) ),
		Heatmap( X, Y, Color( 2 ), Legend( 15 ) )
	),
	SendToReport(
		Dispatch( {}, "400", ScaleBox,
			{Legend Model(
				15,
				Properties( 0, {Transparency( 0 )}, Item ID( "0", 1 ) ),
				Properties(
					1,
					{Fill Color( 0 ), Fill Pattern( "triangle up" )},
					Item ID( "1", 1 )
				),
				Properties(
					-1,
					{Fill Color( 0 ), Fill Pattern( "triangle left" )},
					Item ID( "-1", 1 )
				)
			)}
		)
	)
);

 

hogi
Level XII

Re: Heatmap overlay from multiple variables

you might consider combining the Heatmap with a points plot.
then the data is ready to be processed in the human eye - and the coprocessing via the human brain can be reduced.

OleksandrG
Level II

Re: Heatmap overlay from multiple variables

Hi hogi,

This is also an interesting solution for Application #2. I just need to ensure the color of the ParamA marker is always visible on top of ParamC's color range:

OleksandrG_1-1751336029802.png

 

 

OleksandrG
Level II

Re: Heatmap overlay from multiple variables

Hi christian-z, Thank you, this is exactly what I was looking for!

 

For 1st application, I was able to apply different colors to two Params after enabling their entries in the legend settings (Graph Builder hid legend entries for 2nd param by default, probably because ParamA and ParamB both take same values 0 and 1 only):

OleksandrG_2-1751335026168.png

 

For 2nd application, it's straightforward with two legends:

OleksandrG_3-1751335621734.png

 

 

Recommended Articles