我有一个分类变量的条形图。我正在尝试使轴的标签与轴齐平。本质上,将条形的底部与标签对齐。任何帮助将不胜感激。
这是图形的代码。
travel_deaths %>%
filter(Type %in% commuting,
data_type == "Journeys") %>% #filter out the stupid air travels
mutate(rank = rank(.$deaths)) %>%
ggplot(aes(x = reorder(Type, rank, order = TRUE), y = deaths, fill = factor(rank))) +
geom_bar(stat="identity", show.legend = FALSE) +
geom_text(aes(label = deaths), nudge_y = 40) +
ggtitle("Deaths per Billion Trips") +
scale_fill_manual(values = bloody(9)) +
theme(axis.text.y = element_text(hjust = 1),
axis.ticks.y = element_blank()) +
coord_flip()
当前看起来像这样
这是我希望达到的目标