Automatically plots xts time-series objects (or objects convertible to xts).
Highly configurable axis and series display (including optional 2nd Y-axis).
Display upper/lower bars (e.g. prediction intervals) around series.
Use at the R console just like conventional R plots (via RStudio Viewer).
The dygraphs package is available on CRAN now and can be installed with:
Here are some examples of interactive time series visualizations you can create with only a line or two of R code (the screenshots are static, click them to see the interactive version).
This code adds a range selector that’s can be used to pan and zoom around the series data:
dygraph(nhtemp, main = "New Haven Temperatures") %>% dyRangeSelector()
When you hover over the time-series the values of all points at the location of the mouse are shown in the legend:
lungDeaths <- cbind(ldeaths, mdeaths, fdeaths) dygraph(lungDeaths, main = "Deaths from Lung Disease (UK)") %>% dyOptions(colors = RColorBrewer::brewer.pal(3, "Set2"))
There are a wide variety of tools available to annotate time series. Here we demonstrate creating shaded regions:
dygraph(nhtemp, main="New Haven Temperatures") %>% dySeries(label="Temp (F)", color="black") %>% dyShading(from="1920-1-1", to="1930-1-1", color="#FFE6E6") %>% dyShading(from="1940-1-1", to="1950-1-1", color="#CCEBD6")
You can find additional examples and documentation on the dygraphs for R website.
One of the reasons we are excited about dygraphs is that it takes a mature and feature rich visualization library formerly only accessible to web developers and makes it available to all R users.
Gina Reynolds, Morgan Brown, and Madison McGovern unveil ggxmean, a package that helps users add statistical concepts to plots made with ggplot2.
RStudio Package Manager 2022.07 now lets you publish your own binary packages, saving you time and frustration.