Hello David,

On Nov 13, 2011, at 5:20 AM, David Winsemius wrote:
>> However, when executing plot_raw which invokes dev.new(..) all windows come out blank whereas if I execute each file outside of a loop then I can see the plots properly.
> 
> Perhaps ...(you did not say what package this plot_raw function comes from) ...  Read the FAQ about why lattice plot don't print. (It applies to all grid based plotting functions.)
> 
plot_raw is my own function which just calls ggplot2. So basically I am not using Lattice.

What can I do differently to avoid the new windows coming back empty?

Thanks in advance,
Best regards,
Giovanni

plot_raw <- function(data,connect=TRUE,y_break=500,y_top=-1,label="") {
	dev.new()
	title <- paste(label, sep="")
	if (y_top == -1) {
		y_top <- max(data$Y)		
	}
	
	if (!decouple) {
		# add fake group
		data$Workload <- 'All'
	}
	
	p <- ggplot(data,aes(x=Time,y=Y,group=Workload,shape=Workload,colour=Workload)) + 
		geom_point(fill="white", size=3) + scale_y_continuous(breaks=seq(0,max(data$Y),y_break), limits=c(0, y_top)) + 	
		scale_y_continuous(breaks=seq(0,y_limit_top(data$Y,data$se), y_break_step(data$Y,data$se)), 
				limits=c(0, y_limit_top(data$Y,data$se))) + 
    	opts(title=title) + theme_bw() +
    	scale_x_continuous(breaks=data$Time, labels=as.character(data$Time))		 

    if (connect) {
    	p + geom_line()
    } else {
    	p
    }
}
	[[alternative HTML version deleted]]

