Skip to content
Prev 175168 / 398506 Next

interactive image graphic

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,