Colorize parts of the title in a plot

前端 未结 3 1410
予麋鹿
予麋鹿 2020-12-14 01:58

Is it possible to colorize parts of the title in a plot?

x = 1:10
y = 1:10
plot(x, y, main=\"title (slope=1)\")

In this plot I\'d like to c

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-14 02:17

    This is a quite simple solution to your problem:

    plot(x, y)
    title(expression("title (" * phantom("slope=1)") * ")"), col.main = "black")
    title(expression(phantom("title (") * "slope=1"), col.main = "red")
    

    enter image description here

提交回复
热议问题