Graphing Parameters Titles X-Axis Title Y-Axis Title Legend Scales Color Gridlines library(help="graphics") Basic Chart Types The R Graphics Package LineHistogram ScatterBox
Histogram of NFL Offense hist(nfl$OffPtsA,freq=F, breaks = 25, ylim = c(0,0.14), col = "blue") curve(dnorm(x, mean=mean(nfl$OffPtsA), sd=sd(nfl$OffPtsA)), col="purple", add=T)
Grammar of Graphics formations Legend Axes Seven Components
The anatomy of a graph ggplot2 Components
In ggplot2 a plot is made up of layers. ggplot2 Plot
ggplot2: geoms Ch4HistogramDensityBoxplotScatter Basic Labels Colors
ggplot2: histogram
Histograms: NFL Example Create the plot object: nflHistogram <- ggplot(nfl, aes(OffPtsA)) + opts(legend.position = "none") Add the graphical layer: nflHistogram + geom_histogram(binwidth = 0.4 ) + labs(x = "NFL Offense Points", y = "Frequency")
Scatterplot: NFL Example
rCharts: Scatterplot