8.18 Using Relative Times on an Axis

8.18.1 Problem

You want to use relative times on an axis.

8.18.2 Solution

Times are commonly stored as numbers. For example, the time of day can be stored as a number representing the hour. Time can also be stored as a number representing the number of minutes or seconds from some starting time. In these cases, you map a value to the x- or y-axis and use a formatter to generate the appropriate axis labels (Figure 8.40):

Top: relative times on x-axis; bottom: with formatted timesTop: relative times on x-axis; bottom: with formatted times

Figure 8.40: Top: relative times on x-axis; bottom: with formatted times

8.18.4 See Also

See Recipe 15.21 for information about converting time series objects to data frames.