BookmarkSubscribe
Choose Language Hide Translation Bar
Omega
Community Member

PCA - color map on correlations

Hi everyone,

 

I'm performing a PCA analysis and I really like to visualize the correlations using the 'color map on correlations'. However, I would like to have my variabale labels' at the x and y of this graph (see attached image). Is there any way to do this? 

 

Thank you!

0 Kudos
3 REPLIES 3
ian_jmp
Staff

Re: PCA - color map on correlations

FYI, I note that 'Analyze > Mulitvariate Methods > Multivariate' gives you half of what you want:

Screen Shot 2019-03-19 at 12.05.50.png

0 Kudos
MathStatChem
Community Trekker

Re: PCA - color map on correlations

You can do this with a few steps:

In multivariate platform or principle components platform, display the correlation matrix.

Then right-click the matrix and select "Make into Data Table".

 

3-20-2019 4-56-44 PM.jpg

 

Resulting in this new table

 

3-20-2019 4-58-19 PM.jpg

 

You will have to do some manipulation of that table of correlations:
Use Tables > Stack to create a tall version of the table that 3 columns:  A column with the variable names to use for categories on the X axis, another column with categories for the Y axis, and a column with correlation of the variables in the previous two columns. 

 

3-20-2019 4-59-15 PM.jpg

Now you can use the Graph Builder to create the heat map of these correlations.  I did have to reverse the order of the variables on the X axis in the axis settings to get what you wanted.

 

3-20-2019 4-59-41 PM.jpg

 

Here's a script that recreates all those steps on the sample data table ("Body Measurements.JMP") that I used to illustrate all of this.

 

dt = Open( "$SAMPLE_DATA/Body Measurements.jmp" );
pca = dt << Principal Components(
	Y(
		:Mass,
		:Fore,
		:Bicep,
		:Chest,
		:Neck,
		:Shoulder,
		:Waist,
		:Height,
		:Calf,
		:Thigh,
		:Head
	),
	Correlations( 1 ),

);

dtcorr = Report( pca )["Correlations"][Matrix Box( 1 )] <<
Make Into Data Table;

dtcorrstacked = dtcorr << Stack(
	columns(
		:Mass,
		:Fore,
		:Bicep,
		:Chest,
		:Neck,
		:Shoulder,
		:Waist,
		:Height,
		:Calf,
		:Thigh,
		:Head
	),
	Source Label Column( "VariableYAxis" ),
	Stacked Data Column( "Correlation" )
);
dtcorrstacked << Set Name( "Stacked Correlations" );
Close( dtcorr, NoSave );
Column( dtcorrstacked, "Row" ) << Set Name( "VariableXAxis" );
dtcorrstacked << Graph Builder(
	Size( 531, 531 ),
	Show Control Panel( 0 ),
	Graph Spacing( 4 ),
	Variables(
		X( :VariableXAxis ),
		Y( :VariableYAxis ),
		Color( :Correlation )
	),
	Elements( Heatmap( X, Y, Legend( 6 ) ) ),
	SendToReport(
		Dispatch( {}, "VariableXAxis", ScaleBox, {Reversed Scale} )
	)
);



 

MathStatChem
Community Trekker

Re: PCA - color map on correlations

I was going through some of my old posts, and I wanted to update this thread.  You will be happy to know that in JMP 15, the color map on correlations has been improved and does what you were wanting in the original post.  

colormapcorrelations.png

I love it when the JMP development team listens and makes even small improvements like this that delight their customers!