请看下图并关注蓝色的条形文字(每张图的左上侧)。
当我在 2 个变量上使用 facet_wrap 时,我希望底部条带文本为黑色,而顶部条带文本保持其皇家蓝3 颜色。
我尝试使用 ggthemes、strip.text.x / strip.text.y 选项但不知道如何执行此操作。
这是代码:
ggplot(aes(Año, Valor, group = DEPP, color = DEPP)) +
geom_line(size = 1,
alpha = 0.6 ) +
geom_point(shape = 22,
size = 1.5,
fill = "grey") +
theme_ipsum() +
scale_y_continuous(labels = unit_format(unit = "S/", scale = 1)) +
scale_x_discrete(breaks = c(2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021)) +
theme(axis.title.y = element_blank(),
axis.title.x = element_blank()) + # Delete the title of the y and x axis
labs(
title = "Evolución Valor del Volumen de Producción Según Estado del Pescado y Órigen",
subtitle = "Valor de volumen (Kg equivalentes) registrado por la respectiva Dirección de Extracción y Procesamiento Pesquero (DEPP)",
caption = "Fuente: DIREPRO"
) +
guides(color = "none") +
facet_wrap(DEPP ~reorder(EstadoPescado, -Valor), scales = "free_y", ncol = 3) +
theme(strip.text.x = element_text(size = 11, colour = "royalblue3")) #Using ggthemes
ggsave("desembarque_plot.png",
path = here("figures"),
width = 15*3, height = 8*10,
units = "cm")