[R] Why is bubbles() creating empty png graphs?

From: Rainer M Krug <rkrug_at_sun.ac.za>
Date: Thu 15 Dec 2005 - 22:08:13 EST


This code below produces empty XXX.png files - if I use plot(), it works and if I enter the commands

png(filename=fn)
bubble(positions, do.sqrt=FALSE, main=q) dev.off()

manually, it works as well.

I am lost - any help appreciated.

The weird thing is that it worked before I made some changes... (I don't have a copy of the working version...).

R version:

platform i686-pc-linux-gnu

arch     i686
os       linux-gnu

system i686, linux-gnu
status
major 2
minor 2.0
year 2005
month 10
day 06
svn rev 35749
language R

Operating system: SuSE 10

Rainer


library(gstat)
library(RMySQL)
library(DAAG)

m <- dbDriver("MySQL")
con <- dbConnect(m, group = "renpatch_renosterbos")

tbls <- dbListTables(con)
runs <- 1:5
years <- seq(98, 0, -7)

progress_end <- length(tbls) * length(runs) * length(years) progress <- 0

for (year in years)
{

fd <- paste("/home/rkrug/Documents/R/plots/Y", year, sep="") dir.create(fd, showWarnings=FALSE, recursive = TRUE) for (run in runs)
{

for (tn in tbls)
{

fn <- paste(fd, "/", tn, "_R", run, "_Y", year, ".png", sep="") progress <- progress + 1
cat(progress, 'of', progress_end, " | ", fn, " | ") flush.console()
if (!file.exists(fn))
{

q <- paste("select X,Y,RX from", tn, "where (_run=", run, ") AND (_Year=", year, ")")
rs <- dbSendQuery(con, q)
positions <- fetch(rs, n = -1)
while (!dbHasCompleted(rs))
{

cat(".")
flush.console()
}
cat(length(positions$X), "points")
png(filename=fn)
bubble(positions, do.sqrt=FALSE, main=q) #plot(positions)
dev.off()
pause()
cat(" | Done \n")

}
}
}
}

-- 
--
Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT)

Department of Conservation Ecology
University of Stellenbosch
Matieland 7602
South Africa

Tel:        +27 - (0)72 808 2975 (w)
Fax:        +27 - (0)21 808 3304
Cell:        +27 - (0)83 9479 042

email:    RKrug@sun.ac.za
           Rainer@krugs.de

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Dec 15 22:38:43 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:39 EST