Re: [R] interactive time series plot

From: Paul Murrell <p.murrell_at_auckland.ac.nz>
Date: Tue 30 Aug 2005 - 06:34:57 EST

Hi

You might also want to check out getGraphicsEvent (on Windows)

Paul

Greg Snow wrote:
> I don't think that the par(ask=T) will do it for you. Some alternatives
> to try:
>
> 1. use the slider function in either the relax package or the
> TeachingDemos
> package to create a Tk slider that you move back and forth with the
> mouse
> and have the graph update accordingly.
>
> 2. Use locator(1) to have the user advance the graph by clicking and
> have
> your function determine the direction moved based on if they click
> on the
> right or left part of the graph (see put.points.demo in
> TeachingDemos
> package for an example).
>
> 3. Use the readline function to prompt for keyboard input and move the
>
> window based on the keyboard input.
>
> hope this helps,
>
> Greg Snow, Ph.D.
> Statistical Data Center, LDS Hospital
> Intermountain Health Care
> greg.snow@ihc.com
> (801) 408-8111
>
>

>>>>"Chris Paulse" <cpaulse@aecom.yu.edu> 08/29/05 12:03PM >>>
>>>

> Hi,
>
> I've written the following function to display small windows of a time
> series (and a processed version of it) with mouse clicks used to move
> the
> window forward.
>
>
>
> ViewRawAndProcessed <- function(raw, processed, width=1000)
>
> {
>
> len <- length(raw)
>
> n <- round(len/width)
>
> for (i in 1:n)
>
> {
>
> plot(raw[((i-1)*width):(i*width)], type="s")
>
> lines(processed[((i-1)*width):(i*width)], type="s",
> col="red")
>
> s <- sprintf("%d - %d", (i-1)*width,(i*width))
>
> mtext(s)
>
> par(ask=TRUE)
>
> }
>
> }
>
>
>
> What I'd like to do is modify the function so that it stays within a
> loop
> and accepts right and left cursor keys (or h and l) to shift the
> current
> window backwards and forwards (with the q key causing a break from the
> loop).
>
>
>
> Is this possible with the par(ask=TRUE) command?
>
>
>
> Thanks,
>
> Chris Paulse
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Tue Aug 30 06:42:38 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 16:02:49 EST