cor.plot {psych}R Documentation

Create an image plot for a correlation or factor matrix


Correlation matrices may be shown graphically by using the image function to emphasize structure. This is a particularly useful tool for showing the structure of correlation matrices with a clear structure. Partially meant for the pedagogical value of the graphic for teaching or discussing factor analysis and other multivariate techniques.


      main="Upper and lower confidence intervals of correlations",...)



A correlation matrix or the output of fa, principal or omega.


The object returned from


Display the numeric value of the correlations. Defaults to FALSE.


Defaults to TRUE and colors use colors from the colorRampPalette from red through white to blue, but colors=FALSE will use a grey scale


The number of levels of shading to use. Defaults to 51


A title. Defaults to "correlation plot"


The range of values to color – defaults to -1 to 1


A legend (key) to the colors is shown on the right hand side


if NULL, use column and row names, otherwise use labels


How many categories should be labelled in the legend?


restore the graphic parameters when exiting


scale the numbers by their pvals, categorizing them based upon the values of cuts


Scale the numbers by the categories defined by pval < cuts


Select the subset of variables to plot


Character size. Should be reduced a bit for large numbers of variables.


Other parameters for axis (e.g., cex.axis to change the font size, srt to rotate the numbers in the plot)


When summarizing the correlations of large data bases or when teaching about factor analysis or cluster analysis, it is useful to graphically display the structure of correlation matrices. This is a simple graphical display using the image function.

The difference between mat.plot with a regular image plot is that the primary diagonal goes from the top left to the lower right. zlim defines how to treat the range of possible values. -1 to 1 and the color choice is more reasonable. Setting it as c(0,1) will lead to negative correlations treated as zero. This is advantageous when showing general factor structures, because it makes the 0 white.

The default shows a legend for the color coding on the right hand side of the figure.

Inspired, in part, by a paper by S. Dray (2008) on the number of components problem.

Modified following suggestions by David Condon and Josh Wilt to use a more meaningful color choice ranging from dark red (-1) through white (0) to dark blue (1). Further modified to include the numerical value of the correlation. (Inspired by the corrplot package). These values may be scaled according the the probability values found in or corr.test.

By default calls cor.plot.upperLowerCi and scales the correlations based upon "significance" values. The correlations plotted are the upper and lower confidence boundaries. To show the correlations themselves, call cor.plot directly.

If using the output of corr.test, the upper off diagonal will be scaled by the corrected probability, the lower off diagonal the scaling is the uncorrected probabilities.

If using the output of corr.test or as input to cor.plot.upperLowerCi, the upper off diagonal will be the upper bounds and the lower off diagonal the lower bounds of the confidence intervals.


William Revelle


Dray, Stephane (2008) On the number of principal components: A test of dimensionality based on measurements of similarity between matrices. Computational Statistics \& Data Analysis. 52, 4, 2228-2237.

See Also

fa, mat.sort,, corr.test.


cor.plot(Thurstone,main="9 cognitive variables from Thurstone") #just blue implies positive manifold
#select just some variables to plot
cor.plot(Thurstone, zlim=c(0,1),main="9 cognitive variables from Thurstone",select=1:4)

#now red means less than .5
       main="9 cognitive variables from Thurstone (sorted by factor loading) ")
simp <- sim.circ(24)
cor.plot(cor(simp),main="24 variables in a circumplex")

#scale by raw and adjusted probabilities
rs <- corr.test(sat.act[1:200,] ) #find the probabilities of the correlations
cor.plot(r=rs$r,numbers=TRUE,pval=rs$p,main="Correlations scaled by probability values") 
 #Show the upper and lower confidence intervals

[Package psych version 1.4.5 Index]
Part of the Personality Project      Take our Personality Test