斜体部分标题 [英] R italic partial title

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

问题描述

a希望从for循环中绘制一些图形,其中 main 应当为斜体一半且为正常一半.代码示例应为

a want to plot some graphs from for loop, where the main should be half italic and half normal. The code example should be

 a1<-1:20
 a2<-sample(a1)
 b1<-sample(a1)
 b2<-sample(a1)
 a<-list(a1, a2)
 b<-list(b1, b2)
 v<-c("a", "b")
 for(i in 1:2){
 jpeg(file=sprintf("%s.jpg", v[i]))
 plot(a[[i]], b[[i]], main=c("sas", v[i]))
 dev.off()}

,但 v [i] 应该使用斜体.我尝试过

but the v[i] should be in italic. I tried

 plot(a[[i]], b[[i]], main=c("sas", expression(italic(v[i]))))

但是缺少 main 的第二行.感谢任何想法!

but the second line of main is missing. Thx for any ideas!

推荐答案

如何

 plot(a[[i]], b[[i]], main=bquote("sas"~italic(.(v[i]))))

产生

如果您确实想要两行,可以这样做

Of if you realy wanted two lines, you could do

plot(a[[i]], b[[i]], main=bquote(atop("sas",italic(.(v[i])))))

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

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