Description Usage Arguments Examples
Rotate a geometry about a point clockwise, by a specified angle.
1 | geometry_rotate(geom, angle = NULL, x = 0, y = 0)
|
geom |
A geometry data frame. |
angle |
The angle by which to rotate, clockwise. |
x,y |
The coordinates of the center of rotation. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | scatter_ex %>% plot()
# Rotate 5 degrees about the origin
scatter_ex %>% plot() %>%
geometry_rotate(5) %>% plot(add = TRUE, col = "red")
# Rotate 5 degrees about the smallest point
scatter_ex %>% plot() %>%
geometry_rotate(5, x = 9, y = 12) %>% plot(add = TRUE, col = "red")
# More extreme rotations
scatter_ex %>% plot(xlim = c(-35, 35), ylim = c(-44, 44)) %>%
geometry_rotate(90) %>% plot(add = TRUE, col = "red")
scatter_ex %>% geometry_rotate(75, x = 20, y = 20) %>% plot()
# To rotate bars, you need to convert to polygons with pointificate
bar_ex %>% unique() %>% plot()
bar_ex %>% unique() %>% geometry_pointificate() %>%
geometry_rotate(45, 6, 0.5) %>% plot()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.