问题描述
我想编辑情节的标题,所以它有四个单词,最后一个单词为粗体,例如:标题:这是"(普通字体)我的情节"(粗体).
我尝试了一些在网上找到的代码,但是我只设法使该图的所有标题都加粗.我的代码(示例)看起来像这样,因为我也想更改颜色和标题位置.现在,由于我的代码中的"face = bold",所有标题均以粗体显示.如上所述,我只希望最后两个单词以粗体显示,但在一行中,因此下面没有字幕或另一行.我正在使用ggplot2,将不胜感激!
plot4<-plot4 + labs(标题=这是我的情节")plot4<-plot4 +主题(plot.title = element_text(hjust = 0.5,vjust = 0.1,face ='bold',colour ="blue"))
使用
I want to edit the title of my plot so it has four words with only the last ones being bold, example:Title: "This is" (normal font) "my plot" (bold).
I have tried several codes I found online but I only managed to make all of the title for the plot bold.My code (example) is looking something like this as I also want to change thee colour and the position of the title. Right now all of the title is in bold due to "face=bold" in my code. As explained above I would only like the last two words be in bold, yet in one line, so no subtitle or another line below. I am using ggplot2 and help will be greatly appreciated!
plot4 <- plot4 + labs(title = "This is my plot")
plot4 <- plot4 + theme(plot.title=element_text(hjust=0.5, vjust=0.1, face='bold', colour="blue"))
Use plotmath
as documented by the R Core team and in the ggplot2 wiki.
library(ggplot2)
p <- ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = Species)) +
geom_point()
p + labs(title = bquote('This is' ~ bold('my plot')))
这篇关于如何使剧情标题部分加粗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!