gpt4 book ai didi

R - 如何在 R 中输出部分着色的字符串?

转载 作者:行者123 更新时间:2023-12-04 18:07:31 25 4
gpt4 key购买 nike

我想输出一个部分着色的字符串。例如类似于:

print(paste("This is how", style("Red","red", "bold"), "looks."))

[1]“这就是红色的样子。”

字符串 Red 应为红色。

任何帮助将不胜感激!!

最佳答案

你可以使用 text 破解它:

plot(1:10,1:10,type='n',frame.plot=F,axes=F,xlab="",ylab="")
text(5,1,"This is how")
text(5.8,1,"Red",col='red',font=2)
text(6.3,1,"looks.")

enter image description here

关于R - 如何在 R 中输出部分着色的字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23145079/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com