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. yahoos_f.txt: uid, yahoo, s_ 1, 1, 15726.0 2, 1, 747.0 3, 1, 3504.0 4, 1, 40704.0 5, 1, 43.0 6, 1, 41.0 7, 1, 123.0 8, 1, 65.0 9, 1, 13761110.0 10, 1, 9256.0 11, 1, 46.0 12, 1, 3429.0 13, 1, 34923.0 14, 1, 5830.0 15, 1, 36900.0 16, 1, 342074.0 17, 1, 7.0 18, 1, 1.0 19, 1, 7452.0 20, 1, 47.0 21, 1, 663027.0 22, 1, 331.0 23, 1, 22828.0 24, 1, 67763.0 25, 1, 45546.0 26, 1, 4.0 27, 1, 109148.0 28, 1, 118.0 29, 1, 18376.0 30, 1, 32210.0 31, 1, 1019133.0 32, 1, 219.0 33, 1, 38.0 34, 1, 61889.0 35, 1, 1422.0 36, 1, 606.0 37, 1, 1086609.0 38, 1, 49.0 39, 1, 10619.0 757-864-7114 LARC/J.L.Shipman/jshipman Jeffery.L.Shipman at nasa.gov
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. > >It appears that we cannot set ylim if log="y" is also set. This works: > foundOr <- read.table("yahoos_f.txt", sep="," , header=T) > 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)) but not this: > 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,200)) Again, this works: > plot(foundOr$uid, foundOr$s_, xlab="uid", ylab="Log Search Results", main="uid vs Search", pch=20, col="blue", log = "xy") but not this: > plot(foundOr$uid, foundOr$s_, xlab="uid", ylab="Log Search Results", main="uid vs Search", pch=20, col="blue", log = "xy", xlim=c(0,3000)) From traceback(), the crash occurs in the .Internal() part of axis(). I am not sure why this occurs either. Vik
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