hello, I got a problem with plotting large time series, since I want to store the results in a .PDF file (I want to store several pages of plots). The PDF files get too large to be handled (> 10MB, one was even 200MB big). So I wonder, if there would be a possibilty to either - reduce the file size of the PDF - change the way the plot is generated to reduce the plot size? I use: plot(myDate,myFile[,1],type="l",xlab="Date") using myts = as.ts(start=myDate[1],end=myDate[length(myDate)],x=myFile[,1]) plot.ts(myts,xlab="Date") produces the same file size. for storing the PDF I use: pdf(file=paste(outpath,"myPDF.pdf",sep=''),paper="a4r"). I would be very grateful for an answer!!!!
plotting large time series
4 messages · Agnes Richard, jim holtman, Enrico Schumann +1 more
Try another format (tiff, jpg, etc) to see how they look, what the sizes are for different resolutions. If you have a lot of single points, PDF files get very large because of the commands used to print each point. If you want to keep PDF, then find some way of aggregating the data points so that you plot an "average" of several of them. Depending on what you are trying to show, I have used the hexbin package to plot large numbers of points. Why do you need PDFs? Will something else do?
On Thu, Oct 27, 2011 at 11:39 AM, Agnes Richard <agnes.richard at fhnw.ch> wrote:
hello, I got a problem with plotting large time series, since I want to store the results in a .PDF file (I want to store several pages of plots). The PDF files get too large to be handled (> 10MB, one was even 200MB big). So I wonder, if there would be a possibilty to either - reduce the file size of the PDF - change the way the plot is generated to reduce the plot size? I use: plot(myDate,myFile[,1],type="l",xlab="Date") using myts = as.ts(start=myDate[1],end=myDate[length(myDate)],x=myFile[,1]) plot.ts(myts,xlab="Date") produces the same file size. for storing the PDF I use: pdf(file=paste(outpath,"myPDF.pdf",sep=''),paper="a4r"). I would be very grateful for an answer!!!!
______________________________________________ R-help at 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.
Jim Holtman Data Munger Guru What is the problem that you are trying to solve?
A simple way may be not to plot all data points. But it will depend on
your data if that is a good idea.
Regards,
Enrico
## EXAMPLE
require("zoo")
## random data
dates <- seq(from = as.Date("2000-01-01"),
to = as.Date("2011-10-31"), by = "1 day")
x <- cumsum(rnorm(length(dates)))
## plot all
plot(zoo(x, dates), col = "blue")
## plot every 100th point
subs <- seq(1, length(x), by = 10)
lines(zoo(x[subs], dates[subs]), lwd = 2)
Am 28.10.2011 02:46, schrieb jim holtman:
Try another format (tiff, jpg, etc) to see how they look, what the sizes are for different resolutions. If you have a lot of single points, PDF files get very large because of the commands used to print each point. If you want to keep PDF, then find some way of aggregating the data points so that you plot an "average" of several of them. Depending on what you are trying to show, I have used the hexbin package to plot large numbers of points. Why do you need PDFs? Will something else do? On Thu, Oct 27, 2011 at 11:39 AM, Agnes Richard<agnes.richard at fhnw.ch> wrote:
hello, I got a problem with plotting large time series, since I want to store the results in a .PDF file (I want to store several pages of plots). The PDF files get too large to be handled (> 10MB, one was even 200MB big). So I wonder, if there would be a possibilty to either - reduce the file size of the PDF - change the way the plot is generated to reduce the plot size? I use: plot(myDate,myFile[,1],type="l",xlab="Date") using myts = as.ts(start=myDate[1],end=myDate[length(myDate)],x=myFile[,1]) plot.ts(myts,xlab="Date") produces the same file size. for storing the PDF I use: pdf(file=paste(outpath,"myPDF.pdf",sep=''),paper="a4r"). I would be very grateful for an answer!!!!
______________________________________________ R-help at 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.
Enrico Schumann Lucerne, Switzerland http://nmof.net/
On 10/28/2011 07:21 AM, Enrico Schumann wrote:
A simple way may be not to plot all data points. But it will depend on
your data if that is a good idea.
Regards,
Enrico
## EXAMPLE
require("zoo")
## random data
dates <- seq(from = as.Date("2000-01-01"),
to = as.Date("2011-10-31"), by = "1 day")
x <- cumsum(rnorm(length(dates)))
## plot all
plot(zoo(x, dates), col = "blue")
## plot every 100th point
subs <- seq(1, length(x), by = 10)
lines(zoo(x[subs], dates[subs]), lwd = 2)
Hi, I would only plot every 100th line if the plot itself is unreadable because the points obscure each other. When the problem is that the resulting file is too big, I would favor dumping the file to 'png' file instead of pdf. Making the dpi high enough ensures that the illustration is still publication ready. regards, Paul
Am 28.10.2011 02:46, schrieb jim holtman:
Try another format (tiff, jpg, etc) to see how they look, what the sizes are for different resolutions. If you have a lot of single points, PDF files get very large because of the commands used to print each point. If you want to keep PDF, then find some way of aggregating the data points so that you plot an "average" of several of them. Depending on what you are trying to show, I have used the hexbin package to plot large numbers of points. Why do you need PDFs? Will something else do? On Thu, Oct 27, 2011 at 11:39 AM, Agnes Richard<agnes.richard at fhnw.ch> wrote:
hello, I got a problem with plotting large time series, since I want to store the results in a .PDF file (I want to store several pages of plots). The PDF files get too large to be handled (> 10MB, one was even 200MB big). So I wonder, if there would be a possibilty to either - reduce the file size of the PDF - change the way the plot is generated to reduce the plot size? I use: plot(myDate,myFile[,1],type="l",xlab="Date") using myts = as.ts(start=myDate[1],end=myDate[length(myDate)],x=myFile[,1]) plot.ts(myts,xlab="Date") produces the same file size. for storing the PDF I use: pdf(file=paste(outpath,"myPDF.pdf",sep=''),paper="a4r"). I would be very grateful for an answer!!!!
______________________________________________ R-help at 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.
Paul Hiemstra, Ph.D. Global Climate Division Royal Netherlands Meteorological Institute (KNMI) Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39 P.O. Box 201 | 3730 AE | De Bilt tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770