为绘图中的标题部分着色 [英] Colorize parts of the title in a plot

查看:9
本文介绍了为绘图中的标题部分着色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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)")

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

In this plot I'd like to change the color of slope=1 to red.

推荐答案

这是一个非常简单的解决方案:

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")

这篇关于为绘图中的标题部分着色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆