Adding interactivity with a secondary zoom-in graph

Finally, we are going to add some interactivity to our graph by implementing another similar graph, which will exhibit a zoom-in effect on the one we created before. The idea is that we can select an area of the graph we just created and the one we will place below it will update to only show the specific area we have selected. Seems interesting, doesn't it?

To accomplish this, we need to modify the plotOutput() we inserted at the end of the previous section to include a brush parameter with a call to the brushOpts() function, which in turn receives the name of the unique identifier for the brush input we are creating. This parameter is used to create a special type of input, which retrieves ...

Get R Programming By Example 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.