在图例中对齐符号 [英] Align symbols in the legend
本文介绍了在图例中对齐符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在我的情节中插入一个legant.我用以下代码尝试了此操作:
I woult like to insert a legent to my plot. I tried this with the following code:
plot(1:4)
legend("topleft",legend=expression(paste(theta[1]==7%*%10^-4,sep=" ",theta[2]==-14%*%10^-4),
paste(theta[1]==0,sep=" ",theta[2]==0)),bty="n",cex=1.2)
不幸的是,如您所见,图例的符号在垂直语义中并没有对齐.因此,第二行中的theta_2出现在第一行中theta_1的值下方.
Unfortunately, as you can see, the symbols of the legend are not not aligned in the vertical sence. So theta_2 in the second line appears under the value of theta_1 of the first line.
如何更改代码,以使符号对齐?
How can I change the code, so that the symbols are well aligned?
推荐答案
有一个ncol
自变量....
plot(1:4)
legend("topleft",legend= expression( paste(theta[1]==7%*%10^-4) ,
paste(theta[1]==0) ,
paste( theta[2]==-14%*%10^-4),
paste( theta[2]==0 ) ),
bty="n",cex=1.2 , ncol = 2 )
这篇关于在图例中对齐符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文