dv_xy2subzone | R Documentation |
Convert x, y coordinates to zones and subzones
dv_xy2subzone(x, y = NULL)
x |
numeric: the x coordinate |
y |
numeric: the y coordinate. If |
A tibble with columns zone
and subzone
dv_xy2index
, dv_index2xy
, dv_cone2xy
, dv_xy2zone
## Not run:
## a bunch of random points on and around the court
idx <- round(runif(100, min = 1, max = 10000))
## convert to zones
zn <- dv_xy2subzone(x = idx)
## or, equivalently, convert the index to xy values first
zn <- cbind(zn, dv_index2xy(idx))
## plot
ggplot(zn, aes(x, y, colour = as.factor(zone), shape = subzone)) + geom_point(size = 3) +
ggcourt(labels = NULL)
## the points shoud be coloured by zone
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.