Box Plot as Goal Post

[This article was first published on AdventuresInData, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

For as long as I have been working with water data, I wanted to construct a line graph superimposed on a box and whisker plot where the boxes show the distribution of values and the line shows some current condition.  One of my favorite things about ggplot2 is that it allows users to construct complex combinations of graphs in ways that make sense.

This plot shows daily mean flow values in the Schuylkill River (the blue line) against box plots of the rolling 20-year set of daily mean values.  In this instance, flows in the lower part of the river are higher than the 75th percentile flow value, while flows in the upper part of the river are within the interquartile range.  Each point (and box plot) represents data from a USGS gage retrieved using the dataRetrieval library.  The vertical step increases in the blue line are inputs from tributary gages.  This particular image was developed as part of an automated dashboard hosted by the Delaware River Basin Commission.  R scripts, run in batch mode, are called by Windows Task Scheduler.  The scripts run overnight every night to retrieve data, develop new graphs, and upload the graphs to the dashboard web page providing a near real-time visualization of river conditions.

To leave a comment for the author, please follow the link and comment on their blog: AdventuresInData.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)