I am using ggplot2 in a web application. However, I noticed that on
some servers, the printing of a ggplot can take quite long, which is a
problem for web applications. Ironically, my server with the best
hardware, which usually outperforms all others, performs very bad for
printing ggplots.
I made a little script to test the performance on several servers. It
is attached at the bottom of this message. On my cheap and small
server, the average 'elapsed' time for plotting this graph is about
1.1 sec. However, on my fast server, it is about 3.0 seconds. Both
servers run CentOS 5.3, and R 2.9.1-1. Is there anything I can change
in the server config to speed up the plotting of graphs?
### Testing Script starts here ###
library(ggplot2);
myData <- read.csv("
http://ichart.finance.yahoo.com/table.csv?
s=GOOG&d=7&e=11&f=2009&g=d&a=7&b=19&c=2004&ignore=.csv",header=T);
myData$Date <- as.Date(myData$Date);
test <- function(){
pdf("test.pdf")
myPlot <- qplot(Date,Close,data=myData,geom=c('line','smooth'));
print(myPlot);
dev.off();
}
for(i in 1:10){
print(system.time(test()));
}