Exercise

# The xyplot() method with panel.horizonplot()

Specialized methods support all the usual features of the broader `lattice`

framework. In particular, the default panel functions can be replaced by custom functions. One innovative display design for time series data, known as horizon graphs, is implemented in the `panel.horizonplot()`

function in the `latticeExtra`

package.

Horizon plots allow you to visualize many time series in a small amount of space. The main motivation for this design is to reduce the vertical space occupied by a single time series, without the loss of resolution that would result from simply flattening the usual line graph display. This is achieved in two ways. First, negative values are mirrored to lie above the x-axis, but distinguished from positive values by shading using different colors. Second, values are divided into bands with progressively higher saturation, and the bands are collapsed to wrap them around lower bands.

Your goal in this exercise is to create a horizon plot using the `EuStockMarkets`

dataset.

Instructions

**100 XP**

Load the

`latticeExtra`

package.Create a time series plot of EU stock market data.

- The first argument is the time series,
`EuStockMarkets`

, not a formula. - Specify
`panel.horizonplot`

as the`panel`

function. - Specify
`prepanel.horizonplot`

as the`prepanel`

function.

- The first argument is the time series,

Without the prepanel function, the y-axis limits will cover the full data range, whereas a horizon plot by design needs only a fraction of the range.