I would like to create a bar and line chart using dygraphs, which seems like it should be possible based on the \"Bar & Line Chart\" dygraphs example here, and the
I am not sure this is exactly what you want. What I propose, comes close to the combination of a bar plot and a line plot, without the need to create a separate function.
You can set the type of plot per series, with dySeries
. You can choose between lineplot (default), stepPlot
, and stemPlot
. In addition you may set to see the points with drawPoints
and pointSize
, you may also opt to fill the graph or not with fillGraph
. For other options type ?dySeries
The code looks as follows:
library(dygraphs)
lungDeaths <- cbind(ldeaths, mdeaths)
dygraph(lungDeaths, main = "Main Title") %>%
dySeries("ldeaths", drawPoints = FALSE) %>%
dySeries("mdeaths", stepPlot = TRUE, fillGraph = TRUE)
Yielding this plot:
Please, let me know whether this is what you want.