Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- eg_data_x <- data.frame(
- period = c("1", "2", "1 + 2"),
- grp = c("1", "2", "1 + 2"),
- sum_period = c(20000, 30000, 50000))
- eg_data_x$period <- factor(eg_data_x$period, levels = c("1", "2", "1 + 2"))
- eg_data_x$grp <- factor(eg_data_x$grp, levels = c("1", "2", "1 + 2"))
- total_chickens_by_period <- (
- (ggplot(data = eg_data_x, aes(x=period, y=sum_period, fill = grp)) +
- geom_bar(stat = "identity", color = "black")) +
- scale_fill_manual(values = c("red", "green", "gold")) +
- scale_y_continuous(labels = scales::comma) +
- geom_text(aes(label = sum_period), position = position_stack(vjust = 0.9), fontface = "bold") +
- ggtitle("Total Rubber Chickens by Period") + xlab("Period") + ylab("Chickens") +
- theme(plot.title = element_text(color = "black", size = 14, face = "bold", hjust = 0.5),
- axis.title.x = element_text(color = "black", size = 12, face = "bold"),
- axis.title.y = element_text(color = "black", size = 12, face = "bold")) +
- labs(fill = "Period") )
- total_chickens_by_period
Add Comment
Please, Sign In to add comment