General Goal
I would like to be able to use RShiny to quickly plot large amounts of data that comes from R, and then make small modifications or additions without re-rendering all of the plotted data.
Specific Task
- Plot a large number of points (<100 000) in a scatter plot. I am okay with a short (<5 sec) but perceivable delay in this task.
- In response to a mouse click, detect the nearest plotted point.
- Using some information queried from data related to this point, highlight a small number of other points (<10). I would like this to be instantaneous.
Current Approach
I currently use ggplot2 and RShiny to make apps to help with data analysis. In general I'm very pleased with this combination. So ideally the solution will allow me to still mostly use these tools.
Using only the built-in functionality of RShiny and ggplot2, I have no problem accomplishing my task, except that step 3 cannot be done independently, without redoing step 1. It is my understanding that it is not possible to update or overlay ggplot2 plots without re-rendering them in their entirety.
So, what I am looking for is one of the following to achieve my general goal, in descending order of preference:
- A way to overlay or modify ggplot2 plots without re-rendering.
- An extension or fork or similar R-based to ggplot2 that allows this.
- An alternative to ggplot2 that is similarly easy to integrate with RShiny and R data that can allow this. Maybe an some interface to an existing javascript library? I would still like to be able to manipulate and interact with my plot using all of the RShiny machinery I am familiar with.
I have some knowledge of js but do not feel like learning something like d3 to accomplish such a small task. (If it's possible to use a small bit of d3 or js to do this, that would be great though!) It would be fine to be able to efficiently draw svg on top of ggplot2 plots, but using the same coordinate system.
I am aware of this question, but the solution provided was specific to time-series data.
See Question&Answers more detail:os