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:

lungDeaths <- cbind(mdeaths, fdeaths)
dygraph(lungDeaths, main = "Deaths from Lung Disease (UK)") %>%
  dyOptions(stepPlot = TRUE)

Filling

You can also fill in the area underneath the series as well as customize the alpha value for the filling:

dygraph(ldeaths, main = "Deaths from Lung Disease (UK)") %>%
  dyOptions(fillGraph = TRUE, fillAlpha = 0.4)

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)

Per-Series Options

All of the options above can also be set on a per-series basis using the dySeries function. For example:

dygraph(lungDeaths, main = "Deaths from Lung Disease (UK)") %>%
  dySeries("mdeaths", drawPoints = TRUE, color = "blue") %>%
  dySeries("fdeaths", stepPlot = TRUE, fillGraph = TRUE, color = "red")

Note that you can specify colors globally (as demonstrated above) or per-series, but you cannot mix both styles of assigning colors.

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):

dygraph(ldeaths, main = "Deaths from Lung Disease (UK)") %>%
  dySeries("V1", strokeWidth = 2, strokePattern = "dashed")
Fork me on GitHub