R 在标题中斜体和插入换行符
我试图在我的情节标题中的一个单词斜体化后创建一个换行符 以下是在ggplot2中创建标题的标准代码,该代码有效:R 在标题中斜体和插入换行符,r,ggplot2,R,Ggplot2,我试图在我的情节标题中的一个单词斜体化后创建一个换行符 以下是在ggplot2中创建标题的标准代码,该代码有效: labs(title = "Species\n next line", y = "Y axis", x = "X axis") 一旦我把它定制成斜体。。。断线消失了 labs(title = expression (paste (italic("species"), "subspecies \n new line")) 如何保持尝试插入的换行符 您是否有兴
labs(title = "Species\n next line",
y = "Y axis",
x = "X axis")
一旦我把它定制成斜体。。。断线消失了
labs(title = expression (paste (italic("species"), "subspecies \n new line"))
如何保持尝试插入的换行符 您是否有兴趣使用
字幕
library(ggplot2)
ggplot(iris[iris$Species == "setosa", ], aes(x = Sepal.Width, y = Sepal.Length)) +
theme_bw() +
labs(title = substitute(paste(italic("Iris"), setosa)), subtitle = "new line") +
# labs(title = expression(italic("Iris")~"setosa"), subtitle = "new line") +
geom_smooth(method = "lm", se = FALSE) +
geom_point(shape = 1, size = 2)
要向标题添加粗体字体,可以使用bold()
你是如何将斜体字加粗的?我认为加粗的物种名称之所以出现,是因为名称的大小比副标题大。请参阅我的编辑,了解如何使字体真正粗体。
ggplot(iris[iris$Species == "setosa", ], aes(x = Sepal.Width, y = Sepal.Length)) +
theme_bw() +
ggtitle(label = expression(italic("Iris")~bold("setosa")), subtitle = "new line") +
theme(plot.title = element_text(face = "plain")) +
geom_smooth(method = "lm", se = FALSE) +
geom_point(shape = 1, size = 2)