在ggplot标题中更改行间距?

Mat*_*ert 10 r ggplot2

如果我使用\n,labs(title="whatever \n comes after this")我最终会在线之间留出相当大的空间.有没有办法影响它?(我的意思是除了标题本身的字体大小).

ags*_*udy 10

你可以这样做(选项lineheight来修改行间距)

  p <- qplot(mpg, wt, data = mtcars)
  p <- p + ggtitle("whatever \n comes after this") + 
  theme(plot.title = element_text(lineheight=.1))
  p
Run Code Online (Sandbox Code Playgroud)