June 2016
Beginner to intermediate
1783 pages
71h 22m
English
Line charts are sometimes useful in order to view the pattern of a single variable against its index. Also, in some cases, bivariate connected lines are also useful. In this recipe, we will draw a line chart using ggplot2 with geom_line.
Once again, we recall ggplotdata for this plot. In this case, we will use the two numeric variables, which are disA and disD.
To produce a connected line of a single numeric variable against its observation index, we will use the following code:
# connected line ggplot(data=ggplotdata,aes(x=1:nrow(ggplotdata),y=disA))+geom_line()
The line chart produced is shown in the following figure:
The single variable's connected line looks like a time series plot, ...
Read now
Unlock full access