はじめに ggplot2でグラフを作図していて、軸のラベルやグラフタイトルなどにフォントサイズの違う文字を含む文を書きたいことがある。 例として、以下のコードで作図したグラフを考えてみる。 library(ggplot2) ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) + geom_point() + xlab("Sepal Length[cm]") + ylab("Sepal Width[cm]") + ggtitle("Large text\nSmall text") + theme(plot.title = element_text(size = 20, hjust = 0.5), axis.title.x = element_text(size = 16), axis.title.y = element_