I create an interactive function that will repeatedly build and build reasonably complex graphics ggplot2.
Users provide input (rotation angles for the PCA load matrix, in fact), and I would like to show them rotated results as soon as possible.
Unfortunately, the plot plotting with ggplot2 is rather sluggish.
Note:
- Not much data is stable (about 100 data points or so), so pre-processing will not help (there is a problem with this and many other reports about SO ggplot2 performance).
- Now I have to stick with ggplot2. (I know, I know,
ggobietc ....). - I know the range of possible inputs in advance (0-360): this is a very finite number.
- I cached the ggplot generation functions with
memoise, but this seems to be of little help; the problem is the actual construction of the graphics device. - (I also noticed that RStudio's internal graphics device was especially sluggish).
So, I thought, maybe I would think about somehow pre-rendering all the necessary graphics, possibly saving the graphics device svg()to a file or something like that, and then plot these cached versions as needed .
- On a scale of 1-10, how stupid is the idea?
- Any better ideas?
- Will it even speed up the plotting, or will the graphics device still be a bottleneck?
- Why we do not have hardware acceleration in R: (.
Update
- ( ), , .
- ( )
ggvis ggobi, ( ). - , , (
grid.arrange d) , memoise d - - . - , , - - ?