Description Usage Arguments Examples
Rects are always stacked upwards from the x-axis, ignoring non-zero
y1_
.
1 | geometry_stack(geom, dir = c("y", "x"))
|
geom |
A geometry data frame. |
dir |
Direction in which to stack. "x" or "y" for rects, only "y" for smooths, "r" or "theta" for arcs. |
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 28 29 30 | bar_ex %>% plot()
bar_ex %>% geometry_stack() %>% plot()
bar_ex %>% geometry_flip() %>% plot()
bar_ex %>% geometry_flip() %>% geometry_stack("x") %>% plot()
# Overlapping bars are stacked on top of each other
df <- data.frame(x = 1:3, y = 1:3)
df %>% render_bar(~x, ~y, 2) %>% plot()
df %>% render_bar(~x, ~y, 2) %>% geometry_stack() %>% plot()
# Stacking ribbons
theta <- seq(0, 2 * pi, length = 50)
df <- data.frame(theta)
waves <- rbind(
df %>% render_area(~theta, ~abs(sin(theta))),
df %>% render_area(~theta, ~abs(cos(theta)))
)
waves %>% plot(col = c("red", "black"))
waves %>% geometry_stack() %>% plot(col = c("red", "black"))
df %>% render_area(~theta, ~abs(sin(theta)) + abs(cos(theta))) %>% plot()
# You can also stack arcs, in either r or theta direction
pies <- render_arc(mtcars, ~vs, ~am, 0, 0.1, 0, ~mpg / max(mpg) * 2 / pi)
pies %>% plot()
pies %>% geometry_stack() %>% plot()
pies %>% geometry_stack("r") %>% plot()
disks <- render_arc(mtcars, ~vs, ~am, 0, 0.05, 0, 2 * pi)
disks %>% geometry_stack("r") %>% plot()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.