library(ggplot2)
# Basic scatter plot
ggplot(mpg, aes(x=hwy, y=cyl)) + geom_point()
library(ggplot2)
# Basic scatter plot
ggplot(mpg, aes(x=class, y=drv)) + geom_point()
You can also embed plots, for example:
ggplot(data = mpg)+ geom_point(mapping = aes(x= displ, y = hwy), color = "blue")
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.