您的位置:首页 > 其它

R 控制坐标画图参数

2016-04-14 15:47 543 查看
ILoveLittree

1.关闭x或者y轴的lab:xaxt='n'
or yaxt="n"

2.关闭整个plot的窗口:axes=F

3.调整lab的字体大小:cex.lab=lab.size

4.调整轴的字体大小cex.axis=axis.size

5.调整轴元素之间的距离:mgp=c(2.5,1,0)

mgp:坐标轴各部件的位置。第一个元素为坐标轴位置到坐标轴标签的距离,以文本行高为单位。第二个元素为坐标轴位置到坐标刻度标签的距离。第三个元素为坐标轴位置到实际画的坐标轴的距离,通常是0。

6.axis(1,at=half.len,labels=’test’,tick=F)  #tick 控制坐标轴上的小竖线是否显示

7: X,Y轴互换用horiz=TRUE

8: axis labels的方向 las=0   0,1,2,3    
0: always parallel to the axis [default], 

1: always horizontal, 

2: always perpendicular to the axis, 

3: always vertical.


 

以例子示范:

plot(1:10,1:10,xlab="x",ylab="y",main="ILoveLittree",cex.axis=0.8,cex.lab=2,mgp=c(3,2,1))



更新ing

png("filename.png",width=500,height=500)

par(oma=c(3,3,3,3),mar=c(5,10,5,5),mgp=c(3,2,1),bty="o",xaxt='n')

plot(1:10,1:10,xlab="x",ylab="y",main="ILoveLittree",cex.axis=0.8,cex.lab=2)

box("inner", lty="dotted", col="red")

box("outer", lty="solid", col="blue")

mtext("Made by ILoveLittree", side=1, cex.lab=1.3, line=1, cex=1.2,font.axis=2,outer=TRUE,adj=0)

dev.off()





结合前一次的博客:http://blog.sina.com.cn/s/blog_6babbcb801019njz.html

糗世界: http://pgfe.umassmed.edu/ou/archives/2395

R: http://research.stowers-institute.org/mcm/efg/R/Graphics/Basics/mar-oma/index.htm
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  r语言 生物信息