Note that there are some explanatory texts on larger screens.

plurals
  1. POSpeed up lattice plots by reusing old plot parameters?
    primarykey
    data
    text
    <p>I'm doing some exploratory analyses on large data sets (~10,000 data points grouped into ~ten curves). I am using the <a href="http://www.rstudio.com/ide/docs/advanced/manipulate" rel="nofollow"><code>manipulate</code></a> package in RStudio to change the x-axis limits. The problem is that it can take 5+ seconds for the plot to be redrawn with the new parameters. I am hoping for a way to speed this up just a little bit. I'm using the <code>lattice</code> package. Here is a simplified example...</p> <pre><code>set.seed(100) x = rep(1:5,20) y = rnorm(100) groups = gl(20,5) p = xyplot(y~x,groups=groups,type="l", auto.key=list(space="right",lines=TRUE, points=TRUE,rectangles=TRUE) ) Rprof(interval=0.001) print(p) Rprof(NULL) head( summaryRprof()$by.total ) total.time total.pct self.time self.pct "print" 0.239 100.00 0.000 0.00 "printFunction" 0.239 100.00 0.000 0.00 "print.trellis" 0.239 100.00 0.000 0.00 "do.call" 0.126 52.72 0.001 0.42 "draw.key" 0.098 41.00 0.001 0.42 "evaluate.legend" 0.098 41.00 0.000 0.00 </code></pre> <p>Note that <code>draw.key</code> takes 41% of the run time (and yes, this superfluous legend was chosen to emphasize my point). For my purposes, my legend will never change but the plot will. Is there then a way to save the legend, key, or anything from one plot and reuse it over and over again (perhaps reuse the <code>Grob</code> object from <code>lattice::draw.key</code>)? I have looked into some of the code for <code>lattice:::plot.trellis</code> and it looks like there should be a way to do this. However, it looks like it would take a significant amount of new code to do so. Is there a simple solution? Alternatively, are there any other plotting functions or packages that are known for their speed? I can of course fit smooth curves to my data to "compress/downsample" it, but I'd rather not do this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload