Created
February 28, 2015 20:48
-
-
Save smach/fd804e6fad8f15530acd to your computer and use it in GitHub Desktop.
Useful data visualization of a correlation matrix, code from the R Graphics Cookbook by Winston Chang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function takes a correlation matrix from the cor() function and outputs a visualization. | |
# The corrplot package must be installed. | |
# This code comes from the R Graphics Cookbook by Winston Chang | |
corrviz <- function(mycorrmatrix){ | |
col <- colorRampPalette(c("#BB4444", "#EE9988", "#FFFFFF", "#77AADD", "#4477AA")) | |
corrplot::corrplot(mycorrmatrix, method="shade", shade.col=NA, tl.col="black", tl.srt=45, col=col(200), addCoef.col="black") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment