Dynamically annotate graphs with Shiny

January 18, 2013

(This article was first published on Quantifying Memory, and kindly contributed to R-bloggers)

Below I present a simple way to automatically annotate plots through Shiny It occurred to me that labeling plots should be really easy to do with R-studio’s swanky ‘Shiny’ add on. To test this I gathered some time series data from Wikipedia, added options for the number of points to be labelled, either by date or by view count. I also quickly added some custom labels. To test it, have a play with the app below. It’s not very flexible; I’ve set it to only fetch data for December 2011, but the code is available here for anyone who wants to expand this feature.

The application may be tested here, or scroll down for an embedded version

By default it shows English language Wikipedia views for the Russian blogger Navalny. He emerged as one of the Russian protest movement leaders. The peaks in the graph correspond to the election on December 5th and the following street protests. There is also a peak in searches for Navalny after he was released from jail on December 20 2011.

The key part of the code is displayed below

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

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


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)