18
votes

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.

1
What's log(0)? You're trying to set your axis limit to that. - Spacedman
That makes perfect sense. the infinity in the warning message should've hit me on the head... - sinclairjesse

1 Answers

28
votes

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