在图形标题中插入函数变量 [英] Insert function variable into graph title
本文介绍了在图形标题中插入函数变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个具有两个输入变量的函数
min.depth<-2
max.depth<-5
该函数生成一个图。如何将输入变量插入到标题中?
我已尝试:
plot.a<-plot(plt.a$"Traits",plt.a$"Species",xlab="Site similarity by traits (Tsim)",
ylab="Site similarity by species (Jaccard)",
main=c("Jaccard vs. Tsim for depths", min.depth, "to",max.depth,"m")
虽然这确实会正确插入输入变量,但也会导致标题堆叠,如下所示:
Jaccard vs. Tsim for depths
2
to
5
m
关于如何避免此堆叠有什么建议吗?
推荐答案
您应该使用paste
而不是c
:
plot(..., main=paste("Jaccard vs. Tsim for depths", min.depth, "to",max.depth,"m", sep=" "))
使用c
创建字符串矢量(因此进行堆叠),使用paste
将它们连接成单个字符串。
这篇关于在图形标题中插入函数变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文