Dynamically annotate graphs with Shiny

[This article was first published on Quantifying Memory, 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.

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 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)