sort_geom_box | R Documentation |
Sort order of box obtained from geom_boxplot
sort_geom_box(x, decreasing = TRUE)
x |
ggplot2 with atleast one layer of geom_boxplot |
decreasing |
logical, default TRUE, indicating whether the box are arraged in increasing or decreasing order. |
a ggplot.
library(ggplot2)
dd <- iris %>%
tidyr::pivot_longer(cols = Sepal.Length:Petal.Width)
# single layer
ss <- dd %>%
ggplot2::ggplot() +
geom_boxplot(aes(x = name, y = value))
sort_geom_box(x = ss,decreasing = TRUE)
sort_geom_box(x = ss,decreasing = FALSE)
# multiple layer
ss <- dd %>%
ggplot2::ggplot() +
geom_point(aes(y = value , x = name)) +
geom_boxplot(aes(x = name, y = value))
sort_geom_box(x = ss,decreasing = TRUE)
sort_geom_box(x = ss,decreasing = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.