No data was provided, so I created a dummy data. I created a use case below, otherwise there are get solutions on SO, such as Simplest way to do grouped barplot .
library(tidyverse)
# Data
trees <- data.frame(age = sample(c("Old", "Adult", "Young"),
size = 20, replace = TRUE, prob = c(.5, .25, .25)),
tree = factor(sample(1:5, size = 20, replace = TRUE)),
circumference = rnorm(n = 20, mean = 60, sd = 15))
trees %>%
ggplot(aes(x = age, y = circumference, fill = tree)) +
geom_col(position = "dodge") +
coord_flip()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.