BookmarkSubscribe
Choose Language Hide Translation Bar
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!

3 REPLIES 3
Staff

## Re: PCA - color map on correlations

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

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".

Resulting in this new table

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.

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.

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,
),
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,
),
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} )
)
);

``````

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.

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