我需要更改包装的geom_text层中的行距。
library(ggplot2)
library(stringr)
txt = c('one two three', 'four five six', 'seven eight nine')
p = ggplot(data=NULL, aes(x=1:3, y=1:3, label = str_wrap(txt, width = 3))) +
geom_text() + expand_limits(x = c(0.5, 3.5), y = c(0.5, 3.5))
但是theme(text=element_text(lineheight = ...))
无效,因为theme
仅适用于non-data components of the plot,因此我不清楚如何实现。有建议吗?