tkLocator: Gives the Position

Description Usage Arguments Value Examples

View source: R/functions.R

Description

Gives the position when the left mouse button is pressed + "Ctrl" button.

Usage

1
tkLocator(parent, n = 1)

Arguments

parent

Tk toplevel window

n

the number of points to locate

Value

A list with x and y components which are the coordinates of the identified points.

Examples

 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
## Not run: 
bb <- 1
tt <- tktoplevel()
tt <- tkRplot(tt, function() {
 x <- 1:20 / 20
   plot(
   x,
   x ^ bb,
   col = "#0000ff50",
       xlab = "x",
           ylab = paste0("x^", bb),
               type = "l",
                   axes = FALSE,
                       lwd = 4)
   title(main = bb)
     points(x,
      x ^ bb,
      col = "#ff000050",
      pch = 19,
      cex = 2)
        axis(1)
        axis(2)
          box()
          })
 tkLocator(tt, 2)
 
## End(Not run)

tkRplotR documentation built on June 27, 2021, 5:08 p.m.