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
#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:
Post a Comment