Description Usage Arguments Details Examples
Add binds to automatically resize the graph
1 |
parent |
parent Tk toplevel window |
expose |
if TRUE update graph when the window is expose |
configure |
if TRUE update the graph when the window is update |
This function adds the binds needed to automatically resize the graph
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | ## Not run:
tkbb <- tclVar(1)
tt <- tktoplevel()
tt <- tkRplot(tt, function() {
b <- .tcl2num(tkbb)
x <- 1:20 / 20
plot(
x,
x ^ b,
col = "#0000ff50",
xlab = "x",
ylab = paste0("x^", b),
type = "l",
axes = FALSE,
lwd = 4)
title(main = b)
points(x,
x ^ b,
col = "#ff000050",
pch = 19,
cex = 2)
axis(1)
axis(2)
box()
})
s <-
tkscale(
tt,
from = 0.05,
to = 2.00,
variable = tkbb,
showvalue = FALSE,
resolution = 0.05,
orient = "horiz"
)
tkpack(s,
side = "bottom",
before = tt$env$canvas,
expand = FALSE,
fill = "both")
# to disable the automatic resizing of the graph
tkBinds(parent = tt, expose = FALSE, configure = FALSE)
# to enable again the automatic resising
# tkBinds(parent = tt, expose = TRUE, configure = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.