235
235
235
# Histogram plot
qplot(hwy, data=mpg, fill=drv) # frequency count variable = hwy, 3 different drive
factors are distinguished based on the color or fill factor
# change the theme to black and white using theme_bw() function, theme fonts are
also changed (default theme = theme_gray())
g + geom_point(aes(color = drv)) + theme_bw(base_family="Times")
# Plot facets
g + geom_point() + facet_grid(drv~cyl, margins=TRUE) # The margins argument tells
ggplot to display the marginal totals over each row and column, so instead of
seeing
# 3 rows (the number of drv factors) and 4
columns (the number of cyl factors) we see a 4 by 5 display.