In this chapter, we will cover:
In Chapter 1, Basic Graph Functions and Chapter 2, Beyond the Basics: Adjusting Key Parameters, we learnt some basics of how to make line graphs and customize them by setting certain arguments as per our needs. In this chapter, we will learn some more intermediate to advanced recipes for customizing line graphs even further. We will look at ways to improve and speed up line graphs with multiple lines representing more than one variable.
One of the most used form of line graphs is time trends or time series, where the X variable is some measure of time such as year, month, week, day, hour, and so on. Reading, formatting, and plotting dates can be quite tricky in R. In this chapter, we will see how to deal with dates and process them to make time series charts with custom annotations, grid lines, uncertainty bounds, and markers.
We will also learn to make some interesting and popular types of time series charts such as sparklines and stock charts.
As the recipes in this chapter are slightly more advanced than the earlier chapters, it may take some practice with multiple datasets before you are comfortable with using all the functions. Example datasets are used in each recipe, but it is highly recommended to also work with your own datasets and modify the recipes to suit your own analysis.