【发布时间】:2020-09-22 21:06:53
【问题描述】:
我正在使用 R 中 tidytext 包中的 reorder_within() 函数来绘制不同频率的图。一个类似的例子来自here。
library(tidytext)
top_names %>%
group_by(decade) %>%
top_n(15) %>%
ungroup %>%
mutate(decade = as.factor(decade),
name = reorder_within(name, n, decade)) %>%
ggplot(aes(name, n, fill = decade)) +
geom_col(show.legend = FALSE) +
facet_wrap(~decade, scales = "free_y") +
coord_flip() +
scale_x_reordered() +
scale_y_continuous(expand = c(0,0)) +
labs(y = "Number of babies per decade",
x = NULL,
title = "What were the most common baby names in each decade?",
subtitle = "Via US Social Security Administration")
如何在每个方面将单个项目加粗?例如,如果我想在每个构面的轴标签上加粗大卫的名字,我该怎么做?
【问题讨论】:
-
您可以尝试这篇文章中的解决方案之一:stackoverflow.com/questions/39694490/…