R 控制ggplot2中换行后的文本大小

R 控制ggplot2中换行后的文本大小,r,ggplot2,R,Ggplot2,是否可以在x标签文本中给出不同大小的Stackoverflow和示例 library(ggplot2) ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length)) + geom_point() + labs(x = 'Stackoverflow\nexample') 使用cowplot中的draw_label(): library(ggplot2) library(cowplot) ggplot(iris, aes(x = Sepal.Wi

是否可以在x标签文本中给出不同大小的Stackoverflow和示例

library(ggplot2)
ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length)) + 
  geom_point() + labs(x = 'Stackoverflow\nexample')
使用
cowplot
中的
draw_label()

library(ggplot2)
library(cowplot)

ggplot(iris, aes(x = Sepal.Width, y = Sepal.Length)) + 
  geom_point() +
  xlab("") +
  theme(axis.title.x = element_text(size = 10, # you don't need to define size actually
# margin is important to give you some space on the bottom
                                    margin = margin(t = 10, r = 0, b = 0, l = 0,
                                                    unit = "mm"))) +
  coord_cartesian(clip = "off") +
  draw_label("Stackoverflow", x = 3.25, y = 3.5, size = 15) + 
# play with x,y to center the text
  draw_label("example", x = 3.25, y = 3.25, size = 10)

可能存在的副本