Ch13 Some Notes on Graphics with R

13.6 Some R graphics advice and coding tips

 

Some R graphics advice and coding tips | 267

p0 <- ggplot(diamonds, aes(x=carat)) + ylab("")
p1 <- p0 + geom_bar(binwidth=1) 
p2 <- p0 + geom_bar(binwidth=0.1)
p3 <- p0 + geom_bar(binwidth=0.01)
grid.arrange(arrangeGrob(p1, p2, ncol=2), p3, nrow=2)

 

269

ggplot(Cars93, aes(TypeWt,100/MPG.city)) + geom_boxplot() +
ylab("Gallons per 100 miles") + xlab("Car type")