<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/how-to-plot-with-dygraphs-exercises/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.r-exercises.com/2018/05/18/how-to-plot-with-dygraphs-exercises/"> R-exercises</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><strong>INTRODUCTION</strong></p>
<p>The dygraphs package is an R interface to the dygraphs JavaScript charting library. It provides rich facilities for charting time-series data in R, including:</p>
<p><strong>1</strong>. Automatically plots xts time-series objects (or any object convertible to xts.)</p>
<p><strong>2</strong>. Highly configurable axis and series display (including optional second Y-axis.)</p>
<p><strong>3</strong>. Rich interactive features, including zoom/pan and series/point highlighting.</p>
<p><strong>4</strong>. Display upper/lower bars (ex. prediction intervals) around the series.</p>
<p><strong>5</strong>. Various graph overlays, including shaded regions, event lines, and point annotations.</p>
<p><strong>6</strong>. Use at the R console, just like conventional R plots (via RStudio Viewer.)</p>
<p><strong>7</strong>. Seamless embedding within R Markdown documents and Shiny web applications.</p>
<p>Before proceeding, please follow our short <a rel="nofollow" href="http://r-exercises.com/2018/05/11/how-to-plot-with-dygraphs/" target="_blank">tutorial.</a></p>
<p>Look at the examples given and try to understand the logic behind them. Then, try to solve the exercises below by using R without looking at the answers. Then, check the <a rel="nofollow" href="http://r-exercises.com/2018/05/18/dygraphs-exercises:-solutions" target="_blank">solutions</a> to check your answers.</p>
<p><strong>Exercise 1</strong></p>
<p>Unite the two time series data-sets <code>mdeaths</code> and <code>fdeaths</code> and create a time-series dygraph of the new data-set.</p>
<p><strong>Exercise 2</strong></p>
<p>Insert a date range selector into the dygraph you just created.</p>
<p><strong>Exercise 3</strong></p>
<p>Change the label names of “mdeaths” and “fdeaths” to “Male” and “Female.”</p>
<p><strong>Exercise 4</strong></p>
<p>Make the graph stacked.</p>
<p><strong>Exercise 5</strong></p>
<p>Set the date range selector height to 20.</p>
<p><strong>Exercise 6</strong></p>
<p>Add a main title to your graph.</p>
<p><strong>Exercise 7</strong></p>
<p>Use the tutorial’s predicted data-set to create a dygraph of “lwr”, “fit”, and “upr”, but display the label as the summary of them.</p>
<p><strong>Exercise 8</strong></p>
<p>Set the colors to red.</p>
<p><strong>Exercise 9</strong></p>
<p>Remove the x-axis grid lines from your graph.</p>
<p><strong>Exercise 10</strong></p>
<p>Remove the y-axis grid lines from your graph.</p>
<div>
<h3>Related exercise sets:</h3>
<ol>
<li><a rel="nofollow" href="https://www.r-exercises.com/2017/11/29/spatial-data-analysis-introduction-to-raster-processing-part-1/" title="Spatial Data Analysis: Introduction to Raster Processing (Part 1)" target="_blank">Spatial Data Analysis: Introduction to Raster Processing (Part 1) </a></li>
<li><a rel="nofollow" href="https://www.r-exercises.com/2018/02/28/advanced-techniques-with-raster-data-part-1-unsupervised-classification/" title="Advanced Techniques With Raster Data: Part 1 – Unsupervised Classification" target="_blank">Advanced Techniques With Raster Data: Part 1 – Unsupervised Classification </a></li>
<li><a rel="nofollow" href="https://www.r-exercises.com/2018/01/10/spatial-data-analysis-introduction-to-raster-processing-part-3/" title="Spatial Data Analysis: Introduction to Raster Processing: Part-3" target="_blank">Spatial Data Analysis: Introduction to Raster Processing: Part-3 </a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/start-here-to-learn-r/" target="_blank">Explore all our (>1000) R exercises</a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/r-courses/" target="_blank">Find an R course using our R Course Finder</a> directory</li>
</ol>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.r-exercises.com/2018/05/18/how-to-plot-with-dygraphs-exercises/"> R-exercises</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/QdECI6gXyjk" height="1"></a></div>