Interactive plots

To explore complex patterns in data, simply putting data into a static graph isn't particularly useful. In the big data era, interactive plots demand a lot of time. R has come up with very elegant interactive options:

  • click
  • double-click
  • hover
  • brush
  • zoom in/out
  • selection of area

plotOutput(), like function, provides options to enable these properties to make plots more interactive. Let's explore plotOutput() and use it in our app. Here is the syntax for plotOutput():

plotOutput(outputID,width,height,click=NULL,dbclick=NULL,hover=NULL,hoverDelay=NULL,hoverDelayType=NULL,brush=NULL,clickId=NULL,inline=FALSE) 

Let's develop an application that explores the iris dataset and uses some interactive features of plotting:

library(shiny) ...

Get Web Application Development with R Using Shiny - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.