x <- rnorm(100)
## our handler
plotHist <- function(...)
hist(x, col=gray(svalue(sb)), breaks = svalue(sl))
w <- gwindow("Slider and spinbox example")
tbl = glayout(cont=w)
tbl[1,1] <- "Slide value to adjust shade"
tbl[1,2] <- (sb <- gspinbutton(from=0,to=1,by=0.05,value=.5, container=tbl,
handler=plotHist))
tbl[2,1] <- "No. breaks"
tbl[2,2, expand=TRUE] <- (sl <- gslider(from = 1, to= 100, by=1, value = 10,
cont = tbl, handler = plotHist))
Run the code above in your browser using DataLab