Description Usage Arguments Value Examples
Get coordinates from image of points
1 2 |
input |
Path to image or directly a Magick image. |
x_ticks |
Values of all ticks of the x axis. |
y_ticks |
Values of all ticks of the y axis. |
K |
Number of points in the image.
Use |
K_min |
Minimum number of points in the image. |
K_max |
Maximum number of points in the image. |
max_pixels |
Maximum number of pixels representing points. |
plot |
Whether to plot centers on the image? Default is |
A list of coordinates. There is also an attribute "stat" which was used to guess the number of points in the image.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Create some image
file <- tempfile(fileext = ".png")
png(file, width = 600, height = 400)
plot(y <- c(0, runif(20), 1))
dev.off()
# Get coordinates
(coord <- get_coord(file, seq(5, 20, 5), seq(0, 1, 0.2),
K_min = 10, K_max = 30))
round(coord$x, 2)
plot(coord$y, y, pch = 20, cex = 1.5); abline(0, 1, col = "red")
# When the image is too large, you can downsize it
(coord2 <- file %>% img_read() %>% img_scale(0.7) %>%
get_coord(seq(5, 20, 5), seq(0, 1, 0.2), K_min = 10, K_max = 30))
round(coord2$x, 2)
plot(coord2$y, y, pch = 20, cex = 1.5); abline(0, 1, col = "red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.