Time series plot is commonly used and this post will show you how easy it is to make them using the
mk_lineplot() function from the ezplot package.
- Install a set of development tools
- Install devtools by running
Install and Load ezplot
The ezplot package comes with a films dataset containing the annual boxoffice/budget ratio between 1913 and 2014. We can plot these ratios over the years.
It might be more informative if we use log10 scale on the y-axis.
We can also change the width of the line and the size of the points by passing values to the
We can also use log scale on the y-axis.
Finally, we can plot two time series and color them differently. For example, we can plot annual total budget and boxoffice over the years on the same plot.
I created ezplot because there are too many detailed commands to remember when customizing a ggplot. If ezplot has improved your productivity, please tell your friends about it. In addition, I’m writing a book called ezplot: How to Easily Make ggplot2 Graphics for Data Analysis, and it is 20% complete. Read the sample chapters for FREE and get notified when the book is published.