Let's start from the top:
- We will first discuss some variations of the line graph:
> plot <- ggplot(mtcars, aes(wt, mpg))
- First, we draw the plot. At this point, the graph is not printed as we have not added layers to it. The ggplot needs at least one layer to display the graph:
> plot + geom_line()
- This plots the lines to produce the following line graph:
We can use various arguments to control how the line appears, such as linetype, for the type of line (solid, dashed, and so on), color of the line, and size of the line. We can also provide multiple arguments to this layer and this produces the following plot:
> plot ...