"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

July 24, 2016

Day #27 - Exploring ggplot2

#Why ggplot2 ?
#Plotting system for R
#How to install ?
install.packages("ggplot2")
#What is aes ?
aes creates a list of unevaulated expressions
aes(x= , y= )
#What is geom_point ?
#point geom used to create scatter plots.
#What is a scatter plot ?
#Pairs up two quantitative variables and display them as geometric points
#Examples ?
library(ggplot2)
ggplot(mtcars,aes(wt,mpg))
p = ggplot(mtcars,aes(wt,mpg))
#This line only plots geometric points
p+geom_point()
#Add Color
library(ggplot2)
ggplot(mtcars,aes(wt,mpg))
p = ggplot(mtcars,aes(wt,mpg))
#This line only plots geometric points
p+geom_point(aes(colour=qsec))
#color scale to add this dimension to the plot
#Add Color
library(ggplot2)
ggplot(mtcars,aes(wt,mpg))
p = ggplot(mtcars,aes(wt,mpg))
#This line only plots geometric points
p+geom_point(color="green")
#Scale points
library(ggplot2)
ggplot(mtcars,aes(wt,mpg))
p = ggplot(mtcars,aes(wt,mpg))
#This line only plots geometric points
p+geom_point(aes(size=qsec))
#Next Post with Category Variables
#Reference - https://www3.nd.edu/~steve/computing_with_data/11_geom_examples/ggplot_examples.html

No comments: