延长绘图轴的长度R? [英] Extend the length of a plot axis in R?

查看:77
本文介绍了延长绘图轴的长度R?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在R中延伸轴线以覆盖数据范围?例如,在

How do you extend the axis line in R to cover the extent of your data? For example, in

我的数据到达2100左右,我希望x轴的线走的那么远,但在2100处不打勾或标记.在R中甚至可能吗?

my data goes to about 2100 and I would like the line for the x axis to go that far, but not make a tickmark or label at 2100. Is this even possible in R?

以下是用于绘制以上图形的代码:

Here is the code used to make the above plot:

hist(x,breaks=50,xlab="...",main="",xlim=c(0,2100))

谢谢.

推荐答案

您需要使用两个轴命令.一个用于轴线,另一个用于刻度线和标签.

You need to use two axis commands; one for the axis line and another for the ticks and labels.

set.seed(2); x <- rlnorm(1000, log(130))
hist(x, breaks=seq(0, 3000, by=200), xlim=c(0,2100), xaxt="n")

axis(1, at=c(0,2100), labels=c("",""), lwd.ticks=0)
axis(1, at=seq(0 , 2000, by=200), lwd=0, lwd.ticks=1)

这篇关于延长绘图轴的长度R?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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