## Graphs in R / ggplot2

First Graphs – Scatterplot 2 variables

1 2 3 |
library(ggplot2) ggplot(mtcars, aes(x=cyl, y = mpg)) + geom_point() |

1 2 3 4 5 |
library(ggplot2) # Change the command below so that cyl is treated as factor ggplot(mtcars, aes(x = factor(cyl), y = mpg)) + geom_point() |

The x-axis is now handled asÂ factor. Graphs – Scatterplot with 3 variables This can be done by either add a color or a size. But this is not optimal ( colors can