Description Usage Arguments Examples
gggeom assumes that every geometry can be represented with a single row of a data frame. This poses a challenge for path and polygon geometries which can be of arbitrary length. To solve this problem, gggeom uses a list-column, where each component of the list is of the same type.
1 | coords(x)
|
x |
A list to label as containing coordinates. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | make_spiral <- function(turns, r, n = 200) {
t_grid <- seq(0, turns * 2 * pi, length = n)
r_grid <- seq(0, r, length = n)
df <- data.frame(x = r_grid * sin(t_grid), y = r_grid * cos(t_grid))
render_path(df, ~x, ~y)
}
s1 <- make_spiral(6, 1)
s2 <- make_spiral(-4, 10)
s1
str(s1)
s1$x_
spirals <- rbind(s1, s2)
range(spirals$x_)
spirals %>% plot(col = c("red", "black"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.