

Gregory Snow <Greg.Snow@intermountainmail.org> wrote: Does the following (or some simple modification of it) do what you
want?:

library(tkrplot)

y <- rnorm(10000, 10, 2) + 5*sin( (1:10000)/1000 )

tt <- tktoplevel()
left <- tclVar(1)
oldleft <- tclVar(1)
right <- tclVar(100)

f1 <- function(){
 lleft <- as.numeric(tclvalue(left))
 rright <- as.numeric(tclvalue(right))
 x <- seq(lleft,rright,by=1)
 plot(x,y[x], type='b',ylim=range(y))
}

img <- tkrplot(tt, f1)


f2 <- function(...){
 ol <- as.numeric(tclvalue(oldleft))
 tclvalue(oldleft) <- tclvalue(left)
 r <- as.numeric(tclvalue(right))
 tclvalue(right) <- as.character(r + as.numeric(...) - ol)
 tkrreplot(img)
}

f3 <- function(...){
 tkrreplot(img)
}

f4 <- function(...){
 ol <- as.numeric(tclvalue(oldleft))
 tclvalue(left) <- as.character(ol+100)
 tclvalue(oldleft) <- as.character(ol+100)
 r <- as.numeric(tclvalue(right))
 tclvalue(right) <- as.character(r+100)
 tkrreplot(img)
}

s1 <- tkscale(tt, command=f2, from=1, to=length(y),
 variable=left, orient="horiz",label='left')
s2  <- tkscale(tt, command=f3, from=1, to=length(y),
 variable=right, orient="horiz",label='right')
b1 <- tkbutton(tt, text='->', command=f4)

tkpack(img,s1,s2,b1)





-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@intermountainmail.org
(801) 408-8111
 
 

> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch 
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of Fred J.
> Sent: Monday, March 27, 2006 1:05 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] graphing and scrolling
> 
> Dear R users
>  
>   graphing with plot(x) seams to work for a small length(x), 
> when length(x)  is too large it seams to clutter the display, 
> a solution would be to  display subsets of x at a time, yet a 
> better way which I hope R  supports is to place a sliding bar 
> on the display window to control  length(x) and thus the 
> resolution, which will involve auto scaling  the y axis as 
> well as automatically place a side-to-side scrolling bar  at 
> the bottom of the chart to move through and display the 
> subsets of  x  according  to the resolution. is there such an 
> implementation?
>  
>  thank you
>  
>   
> ---------------------------------
> 
>  [[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
> 


 thanks
 that was very helpful. 
 i have been reading  and trying to modify the code around to suit, but haven't been able to:
 
 first, maximize the chart with the window being maximized, the way it is it stays the same size after maximizing the window.
 
 second, plotting another sequence which share the same index with the first sequence but with different values, its scale I wish to place on the right side of the chart.
 
 

		
---------------------------------

	[[alternative HTML version deleted]]

