On Jul 17, 2009, at 11:27 AM, NDC/jshipman wrote:

Hi,
I am new to R plot. I am trying to scale my y axis in log. When I do this I receive the following error

Error in axis(side = side, at = at, labels = labels, ...) :
 CreateAtVector [log-axis()]: axp[0] = 0 < 0!
In addition: Warning messages:
1: In plot.window(...) :
 nonfinite axis limits [GScale(-inf,1.31772,2, .); log=1]
2: In axis(side = side, at = at, labels = labels, ...) :
 CreateAtVector "log"(from axis()): axp[0] = 0 !


My code is as follows:

foundOr <- read.table("yahoos_f.txt", sep="," , header=T)
if (max(foundOr$s_) >= max(notFoundOr$s_)) maxY = log(max(foundOr $s_)) else maxY = log(max(notFoundOr$s_)) jpeg('clusterYS_.jpg', quality = 100, bg = "white", res = 200, width = 2000, height = 2000 ) plot(foundOr$uid, foundOr$s_, xlab="uid", ylab="Log Search Results", main="uid vs Search", pch=20, col="blue", log = "y", xlim=c(0,300), ylim=c(0,maxY))
dev.off()

If I remove the log = "y" everything works fine. Am I using the log call incorrectly? Any help would be appreciated.

You are trying to set the minimum value of the y axis to 0 and:

> log10(0)
[1] -Inf

Note that when log scaled axes are used, they are common logs (base 10), not natural logs (base e).

Since the y axis is already log10 transformed internally, you don't need to set the maximum value of the y axis to log10(max(foundOr$s_)). Just use max(foundOr$s_)...

HTH,

Marc Schwartz

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to