[R] Interactive plot
Greg.Snow at imail.org
Mon Jun 30 18:33:35 CEST 2008
Here is a way that works for me using tkexamp in the TeachingDemos package (which uses tkrplot internally):
calc2 <- function(mat, vary1=0, vary2=0) calc(mat, c(vary1,vary2))
tkexamp( calc2(mat, vary2=vary),
list(vary1=list('slider',from=0,to=4000, resolution=100, init=vary)))
list( vary1=list('slider', from=0, to=4000, resolution=100, init=vary),
vary2=list('slider', from=0, to=4000, resolution=100, init=vary)))
If you really want to use tkrplot directly, let me know, but it is a lot more code than above.
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Ron Michael
> Sent: Saturday, June 28, 2008 11:00 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] Interactive plot
> Hi all,
> I have created following codes :
> mat = cbind(c(0.000059710430,0.000023057380),
> c(0.000023057380, 0.00005971089)) set.seed = 1000 vary =
> runif(dim(mat), 2000, 3000) calc = function(mat, vary)
> result = vector(length = (length(vary)+1))
> result = sqrt(t(vary) %*% vary)
> for (i in 1 : length(vary))
> result[(i+1)] = sum(vary)*sum(vary*mat[,i])
> Now I want to present the plot in some interactive manner. I
> want to put a slider in the plot where user move the slider
> for the 1st element of the vector "vary" and automatically
> this result will be reflected at the plot window. I already
> gone through some examples of "tkrplot" library, however
> unfortunately could not figure out how i can apply them in my problem.
> If anyone here explain me how to do that I would be grateful.
> Send instant messages to your online friends
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help