Re: [R] interactive image graphic

2009-03-27 Thread Greg Snow
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.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Abelian
> Sent: Thursday, March 26, 2009 9:43 PM
> To: r-help@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@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.

__
R-help@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.


[R] interactive image graphic

2009-03-27 Thread Abelian
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@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.