Plotting correlations matrices in R Package

Correlations matrices give us relevant information, but sometimes it is hard to visualize them.

R Package provides several functions to plot correlations matrices. Following there is a very simple but effective solution for plotting a correlation matrix using package “corrplot”.

library(corrplot);

data <- array(data=runif(100, min=-1, max=1)
 , dim=c(10,10)
 , dimnames=list(paste("A", 1:10, sep=""), paste("B", 1:10, sep="")));

corrplot(data, type="full", order="hclust", tl.col="black", tl.srt=45)

And this is the plot:

test

Positive correlations are displayed in blue and negative correlations in red color. Color intensity and the size of the circle are proportional to the correlation coefficients. The legend color shows the correlation coefficients and the corresponding colors.

Further examples can be found at http://www.sthda.com/english/wiki/correlation-matrix-a-quick-start-guide-to-analyze-format-and-visualize-a-correlation-matrix-using-r-software

Advertisements
This entry was posted in Data Mining and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s