0
我一直在搜索如何包裝文本。似乎應該有一種方法來使用labeller = label_wrap_gen(3),但我不斷收到錯誤: ---邊緣誤差(變量,邊距):未使用的參數(邊距)如何在ggplot中爲facet_grid標籤包裝文本
這是我的代碼的一部分:
#simpson by protected status for domain FKNMS
ggplot(data = fk_strata_abun_diversity, aes(x = YEAR)) +
geom_point(aes(y = strata_simpson, color = "strata_simpson"),color = "blue") +
geom_line(aes(y = strata_simpson, color = "strata_simpson"), color = "blue") +
facet_grid(STRAT ~ protected_status,
labeller = labeller(.rows = strata_names, .cols = protected_status_names),
label_wrap_gen(width = 2)) + #error: in margins(vars, margins) : unused argument (margins) ??
labs(x = "Year", y = "Effective Number of Species") +
ggtitle("Simpson Diveristy of Reef Fish in the Florida Keys by Strata") +
theme(plot.title = element_text(hjust = 0.5, face = 'bold', size = 12)) +
scale_x_continuous(limits = c(1999, 2016), breaks = c(1999:2016)) +
scale_y_continuous(limits= c(0, 25), breaks = c(5,10,15,20,25))
預先感謝您的幫助