在R中使用对数刻度时指定xlim和ylim [英] Specifying xlim and ylim when using log-scale in R

查看:360
本文介绍了在R中使用对数刻度时指定xlim和ylim的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为对数刻度图指定x轴和y轴的上下范围.我以为可以使用xlim和ylim,但是我收到警告消息,但没有任何提示:

I'm trying to specify the lower and upper range for the x- and y-axis for a log-scale plot. I thought I could use xlim and ylim, but I receive a warning message and no plot:

1:在plot.window(...)中: 非限定轴限制[GScale(-inf,3.30103,1,.); log = 1]

1: In plot.window(...) : nonfinite axis limits [GScale(-inf,3.30103,1, .); log=1]

这是我的代码.

plot(FAS_set$ConcCalc~ZCS_set$ConcCalc,pch=21,bg="black",log="xy",xlim=c(0,2000),ylim=c(0,100000))

plot(FAS_set$ConcCalc~ZCS_set$ConcCalc,pch=21,bg="black",log="xy",xlim=c(0,2000),ylim=c(0,100000))

任何帮助将不胜感激.

干杯.

推荐答案

在对数刻度上,0为负无穷大.将您的下限更改为0.000001或类似的值,您会没事的,例如,可以这样做:

On a log-scale, 0 is minus infinity. Change your lower limit to 0.000001 or something and you'll be fine, eg this works:

 plot(1:10, xlim=c(0.001,10), ylim=c(0.001,10), log="xy")

这篇关于在R中使用对数刻度时指定xlim和ylim的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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