R language Access Menu

Graphical representation of correlation

Easiest way to demonstrate correlation between 2 variables graphically is by showing a scatterplot and regression line as follows:

code:

    > ggplot(bwdf, aes(x=age, y=lwt))+ geom_point()+ geom_smooth(method='lm')

                    

Spider or radar plots can also be used to show correlation of one variable with all other variables: 

code:

    > library(psych)
    > spider(y=1, x=2:9, data=scale(birthwt), connect=F)

                   

Blue lines indicate positive correlation while red lines indicate negative correlation.

The points can be connected to show a radar plot: 

code:

    > library(psych)
    > spider(y=1, x=2:9, data=scale(birthwt), connect=T)

                      

 


    Comments & Feedback