[R] RWiki, tcltk and plot

Greg Snow Greg.Snow at intermountainmail.org
Fri Mar 30 21:54:56 CEST 2007


Look at the tkrplot package.

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

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of 
> Alberto Monteiro
> Sent: Friday, March 30, 2007 1:28 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] RWiki, tcltk and plot
> 
> I think I - almost - got the knack for GUI programming using 
> the tcltk library. Maybe I will update the RWiki with this:
> 
> #
> #################################################
> #
> 
> library(tcltk)
> 
> #
> # Create some matrix - nothing about tcltk here # matrix <- 
> cbind(rnorm(100), rpois(100, lambda=10),
>   runif(100), rt(100, df=2), rt(100, df=4))
> 
> colnames(matrix) <- c("Normal", "Poisson (lambda=10)",
>   "U(0,1)", "Student t (nu=2)", "Student t (nu=4)")
> 
> #
> # Now comes the interesting part
> #
> tt <- tktoplevel()
> tkwm.title(tt, "A bunch of distributions") dist.widget <- 
> NULL plot.widget <- NULL for (i in 1:length(colnames(matrix))) {
>   dist.widget[[i]] <- tklabel(tt, text=(colnames(matrix))[i])
>   plot.widget[[i]] <- local({
>     n <- i
>     tkbutton(tt, text="PLOT", command=function() plot(matrix[,n]))
>   })
>   tkgrid(dist.widget[[i]], row=i-1)
>   tkgrid(plot.widget[[i]], row=i-1, column=1) }
> 
> #
> # Game over - click and watch !!!
> #
> ###############################################
> #
> 
> My question: is there any way to integrate the plot part into 
> a tcltk window?
> 
> Alberto Monteiro
> 
> ______________________________________________
> R-help at 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
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list