Back to Browse

Tutorial 7-Correlogram Data Visualization using R and GGplot2, plotting Correlation

2.7K views
Jun 20, 2020
8:04

#R #Rtutorial #Ronlinetraining #correlogram #correlation Watch till the end to learn the strength of ggplot2 Visualization of correlation using correlogram This session demonstrates how to plot visualize the correlation between variables using ggplot2. A correlogram is discussed here. data sets used are iris. Correlograms have been plotted using plot() function of base R, corrgram() function of corrgram package, ggpairs() and ggcor() functions form ggallay package, plotcorr() function of ellipse package and scattermatrix fucntion of car package. Its a thorugh tutorial on corelation plots. The following code is used in the tutorial. https://drive.google.com/file/d/1xMqIT8Rg1-9fcUO8EBNhLad2el9LCeWH/view?usp=sharing ############################################################################### # 3. Correlogram # # ############################################################################### #using plot() function plot(iris, col="blue") # corrgram package install.packages("corrgram") library(corrgram) corrgram(iris) # ellipse with regression line corrgram(iris,panel=panel.ellipse) # ellipse on lower panel only p=corrgram(iris,lower.panel=panel.ellipse) png("cp.png") p dev.off() #lower panel only corrgram(iris,lower.panel=panel.shade, upper.panel = NULL) # ordering as per correlation strength corrgram(iris,order=TRUE) #ggally package install.packages("GGally") library(GGally) #using ggpairs() function ggpairs(iris) # mapping attribute to a variable ggpairs(iris, ggplot2::aes(colour=Species)) #using ggcorr() function ggcorr(iris) ggcorr(mtcars) ggcorr(mpg) ggcorr(diamonds) #ellipse package install.packages("ellipse") library(ellipse) # it takes correlation matrix as input cor_iris=cor(iris[1:4]) plotcorr(cor_iris) #car package install.packages("car") library(car) scatterplotMatrix(~Sepal.Width+Sepal.Length+Petal.Length+Petal.Width|Species, data=iris)

Download

0 formats

No download links available.

Tutorial 7-Correlogram Data Visualization using R and GGplot2, plotting Correlation | NatokHD