How can I use bold, italic and underline in a graphic title or axis in ggplot2?
You can make text bold or italic by setting the face of the text element. I do not know how to make an underline but I'll come back with the answer if I find it.
ggplot(DF, aes(X,Y)) + geom_point()+labs(title="The Title") +
theme(plot.title=element_text(face="italic"))
ggplot(DF, aes(X,Y)) + geom_point()+labs(title="The Title") +
theme(plot.title=element_text(face="bold"))
1 Like
Her is a way to underline. Notice the use of ~ to make spaces within expression().
ggplot(DF, aes(X,Y)) + geom_point() + labs(title = expression(underline(The~Title)))
1 Like
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.