[R] saving contour() plot info
Robert Douglas Kinley
kinley_robert at lilly.com
Tue Jul 3 17:17:10 CEST 2012
Many thanks for these ideas ... I'll try them, and report back
Cheers Bob Kinley
-----Original Message-----
From: Duncan Murdoch [mailto:murdoch.duncan at gmail.com]
Sent: 03 July 2012 15:54
To: Robert Douglas Kinley
Cc: r-help at r-project.org
Subject: Re: [R] saving contour() plot info
On 03/07/2012 10:36 AM, Robert Douglas Kinley wrote:
> { I think this message got rejected at the 1st attempt - trying again}
>
> R 2.15.1 , windows XP
>
> I have a very non-stationary bivariate time-series - say {xt,yt} t=1 ... lots.
>
> I want to do a bivariate density contour-plot of the whole series and then step
> through the series 1 second at a time plotting that second's {x,y} subset on top of the contour
> plot and losing the previous second's subset so that the effect enables you to see
> an 'animation' of how the series 'travels' through different parts of the joint density as time passes.
>
> The only way I've found to do this is to repeatedly call contour() before plotting each
> seconds-worth of data ... this works, but because of the time taken to do the contour()
> calculations in each step of the loop , it has an unpleasant flashing appearance.
Generally the way to get rid of the flashing is to use dev.hold() while
plotting, then dev.flush() when done. This isn't supported on all
graphics devices.
>
> Is it possible to run contour() just once and save the contour- plotting info, so that in each
> step of the loop I only have do the actual plotting of the contours?
It is possible to save the contour information. See ?contourLines. This
doesn't save everything (e.g. the labelling), but it might be enough for
you.
You could also try using recordPlot() after plotting the contours, then
replayPlot() when you want to reproduce them.
Duncan Murdoch
>
> Or any other way of achieving the desired outcome.
>
> Grateful for any guidance ... Bob Kinley
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list