Series Colors
You can specify an alternate color palette for series lines using the
colors option. For example, to choose a palette from RColorBrewer:
lungDeaths <- cbind(ldeaths, mdeaths, fdeaths)
dygraph(lungDeaths, main = "Deaths from Lung Disease (UK)") |>
dyOptions(colors = RColorBrewer::brewer.pal(3, "Set2"))Step Plots
By default dygraphs() displays series as a line, you can
however plot series as step chart as follows:
Filling
You can also fill in the area underneath the series as well as customize the alpha value for the filling:
Point Display
You can include display of the individual points in a series as well as customize the size of the points:
dygraph(ldeaths, main = "Deaths from Lung Disease (UK)") |>
dyOptions(drawPoints = TRUE, pointSize = 2)Different point shapes are available as well:
dygraph(ldeaths, main = "Deaths from Lung Disease (UK)") |>
dyOptions(drawPoints = TRUE, pointSize = 5, pointShape = "triangle")The possible parameters for pointShape are:
triangle, square, diamond,
pentagon, hexagon, circle,
star, plus or ex.
Per-Series Options
All of the options above can also be set on a per-series basis using
the dySeries() function. For example:
Line Strokes
You can also customize the way that series lines are drawn. Here we draw a wider line with a custom stroke pattern (dashed line):
dyGroup()
With dyGroup() you can replicate options across multiple
series or pass a vector of values and have it replicate across the
series. If arguments differ in length than the number of series named,
then the argument will be cycled across the named series.