r - 为绘图中的标题部分着色

是否可以为绘图中的标题部分着色?

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

在此图中,我想将 slope=1 的颜色更改为红色。

最佳答案

这是解决您的问题的一个非常简单的方法:

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

https://stackoverflow.com/questions/17083362/

相关文章:

java - 如何在 Java 中使用 String.format()?

jquery - 如何在输入时更改输入中的电话号码格式?

html - 在 Vim 中格式化和缩进 HTML

html - 如何更改eclipse html格式

formatting - Groovy 有源代码格式化程序吗?

eclipse - 如何防止 Eclipse 格式化程序弄乱带有文本符号的注释?

c# - 在c#中格式化日期

formatting - 格式化代码的正确方法是什么?

html - 防止CKEditor在源代码模式下格式化代码

java - 如何将数字格式化为十六进制字符串?