R 控制坐标画图参数

ILoveLittree

1.关闭x或者y轴的labxaxt='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))

R语言作图的小方法--作图布局与坐标轴的控制


更新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()


R语言作图的小方法--作图布局与坐标轴的控制



结合前一次的博客: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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值