Learn R Programming

Deducer (version 0.7-9)

ggcorplot: Correlation matrix

Description

Plots a correlation matrix

Usage

ggcorplot(cor.mat,data=NULL,lines=TRUE,line.method=c("lm","loess"),type="points", alpha=.25,main="auto",var_text_size=5, cor_text_limits=c(5,25),level=.05)

Arguments

cor.mat
a cor.matrix object to plot
data
the data.frame used to compute the correlation matrix
lines
Logical. Should regression lines be drawn.
type
type of plot. "points" or "bins"
line.method
Character. Type of regression line.
alpha
numeric. level of alpha transparency for the points.
main
Title of the plot. defaults to the method of cor.mat.
var_text_size
size of the diagonal variable names.
cor_text_limits
lower and upper bounds for the size of the correlation text.
level
the size of the test differentiated by text color.

See Also

cor.matrix qscatter_array

Examples

Run this code
data(mtcars)
corr.mat1<-cor.matrix(variables=d(mpg,carb,carb+rnorm(length(carb))),,
	 data=mtcars,
	 test=cor.test,
	 method='spearman',
	alternative="two.sided",exact=FALSE)
	
p<-ggcorplot(corr.mat1,data = mtcars)
print(p)
## Not run: 
# 
# has.hex<-require("hexbin")
# if(has.hex){
# 	data(diamonds)
# 	corr.mat<-cor.matrix(variables=d(price,carat,color),,
# 		 data=diamonds,
# 		 test=cor.test,
# 		 method='spearman',
# 		alternative="two.sided")
# 
# 	p1 <- ggcorplot(cor.mat=corr.mat,data=diamonds,type="bins",
# 		cor_text_limits=c(5,15),
# 		lines=FALSE)
# 	print(p1)
# 	rm('corr.mat')
# 
# }
# ## End(Not run)

Run the code above in your browser using DataLab