In general, this means that it’s not possible to create Shiny apps where action and response is percieved as instanteous (i.e. the plot appears to update simultaneously with your action upon it). plotOutput() generates a new PNG and sends it to the browser.įor local apps, the bottleneck tends to be the time taken to draw the plot.ĭepending on how complex the plot is, this may take a signficant fraction of a second.īut for hosted apps, you also have to take into account the time needed to transmit the event from the browser to R, and then the rendered plot back from R to the browser.All the downstream reactive consumers are recomputed.Shiny sends the mouse event data back to R, telling the app that the input is now out of date.To give the user some way to start afresh, I make double clicking reset the selection.įigure 7.5 shows a couple of screenshots from the running app.īefore we move on, it’s important to understand the basic data flow in interactive plots in order to understand their limitations. To make this work, I initialise the reactiveVal() to a vector of FALSEs, then use brushedPoints() and | to add any points under the brush to the selection. Here I display the selection using different colours, but you could imagine many other applications. I want to use a brush to progressively add points to a selection. To find the correct range I did a little interactive experimentation, but you can work out the exact details if needed (see the exercises at the end of the chapter). I set the limits to scale_size_area() to ensure that sizes are comparable across clicks.I think it’s good practice to put related variables together in a data frame before visualising it. I add the distances to the data frame before plotting.There are two important ggplot2 techniques to note here: Here I show the results of clicking on a point on the far left See live at. Figure 7.4: This app uses a reactiveVal() to store the distance to the point that was last clicked, which is then mapped to point size.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |