[R] interactive image graphic

Greg Snow Greg.Snow at imail.org
Fri Mar 27 16:47:22 CET 2009


Here is some code that may get you started (if I am understanding your question correctly):

library(TeachingDemos)

myfunc <- function(zmin=90, zmax=195, ncol=100, pal='heat') {
	cols <- switch(pal,
		heat=heat.colors(ncol),
		terrain=terrain.colors(ncol),
		topo=topo.colors(ncol),
		cm=cm.colors(ncol)
	)
	image(volcano, col=cols, zlim=c(zmin,zmax))
}

mylist <- list( 
		zmin=list('slider',from=0, to=90, init=90, resolution=5),
		zmax=list('slider',from=195, to=250, init=195, resolution=5),
		ncol=list('spinbox', init=100, from=2, to=150, increment=5),
		pal=list('radiobuttons', values=c('heat','terrain','topo','cm'),
				init='heat')) 

tkexamp(myfunc,mylist)

		
hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Abelian
> Sent: Thursday, March 26, 2009 9:43 PM
> To: r-help at r-project.org
> Subject: [R] interactive image graphic
> 
> Dear All
> I want to plot a kind of figures, which can interactive with user.
> For example, i have a matirx which can be showed by image function.
> i.e. we can compare the value depend on different colors.
> However, the change of colors depend on the range of value.
> Nowaday, i want to set a bar, which can be moved by user such that the
> user can obtain the appropriate range.
> Does anyone suggest me which function can be applied to solve this
> problem?
> Thanks
> 
> ______________________________________________
> 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