我正在用git add *.txt *.xml
绘制几个国家的时间序列。我已经使用以下代码成功绘制了一个包含各个国家趋势的多面图:
gghighlight_line
并生成以下情节:
现在,我正在尝试删除与每行关联的标签,并且我想知道oecd %>%
filter(country %in% c("Germany", "France", "United Kingdom", "United States", "Canada", "Japan", "Italy", "Netherlands", "Spain")) %>%
gghighlight_line(., aes(year, pop_65, colour = country, group= country), predicate = max(pop_65) > 0, label_key = " ") +
scale_x_discrete( breaks = c(2000, 2005, 2010, 2015)) +
facet_wrap(~ country) +
theme_minimal()
中是否有这样的选项。提前非常感谢
答案 0 :(得分:1)
您可以添加参数use_direct_label = FALSE
来删除行中的标签。
gghighlight_line(., aes(year, pop_65, colour = country, group= country), predicate =
max(pop_65) > 0, label_key = " ", use_direct_label = FALSE)
请注意,这不仅将它们从行中删除;还将标签直接放置在图例上。如果出于某种原因要完全隐藏它们,则可以在末尾添加:
oecd %>%
filter(country %in% c("Germany", "France", "United Kingdom", "United States",
"Canada", "Japan", "Italy", "Netherlands", "Spain")) %>%
gghighlight_line(., aes(year, pop_65, colour = country, group= country), predicate =
max(pop_65) > 0, label_key = " ") +
scale_x_discrete( breaks = c(2000, 2005, 2010, 2015)) +
facet_wrap(~ country) +
theme_minimal() +
theme(legend.position = "none") # remove legend