Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
729 views
in Technique[技术] by (71.8m points)

plot - Specifying xlim and ylim when using log-scale in R

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: In plot.window(...) : nonfinite axis limits [GScale(-inf,3.30103,1, .); log=1]

Here is my code.

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

Any help would be appreciated.

Cheers.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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")

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...