Chapter 7 Graphics

Exercise 7.6.1

Make a plot with click handle that shows all the data returned in the input.

Exercise 7.6.2

Make a plot with click, dblclick, hover, and brush output handlers and nicely display the current selection in the sidebar. Plot the plot in the main panel.

Solution. Solution

We can use the nearPoints function to extract the data from plot_click, plot_dbl, and plot_hover. We need to use the function brushedPoints to extract the points within the plot_brush area.

To ‘nicely’ display the current selection, we will use dataTableOutput.

Exercise 7.6.3

Compute the limits of the distance scale using the size of the plot.