nwew
2005-Sep-28 22:43 UTC
[R] Problem with memory footprint of qq plot generated with lattice
Dear R helpers,
I generate a qq plot using the following function call.
qqmath(~val|ind,data=xx
,distribution=function(p) qt(p,df=19)
,ylab="Sample Quatinles"
,xlab="Theoretical Quantiles"
,aspect=1
,prepanel = prepanel.qqmathline
,panel=function(x,y)
{
panel.qqmathline(y, distribution=function(p) qt(p,df=19),col=2)
panel.qqmath(x, y , distribution=function(p)
qt(p,df=19),pch=".",cex=2)
}
)
dim(xx)
[1] 680237 2
unique(xx[,1])
[1] 500-530 1000-1110 2000-2200 3400-3700
Levels: 500-530 1000-1110 2000-2200 3400-3700
It means that actually four small qqplots are drawn.
The problem is that the generated pdf is extremely large.
-rw-r--r-- 1 nwew bayes 19734746 2005-08-27 15:38 Distr-qqplot.pdf
Suggestions howe to reduce the size but keep the quality are wellcome.
cheers
Eryk
dhinds@sonic.net
2005-Sep-28 23:53 UTC
[R] Problem with memory footprint of qq plot generated with lattice
nwew <W.E.Wolski at newcastle.ac.uk> wrote:> Dear R helpers,> I generate a qq plot using the following function call....> dim(xx) > [1] 680237 2How about doing something like this: fn <- function(n,cut=0.001,m=1000) { p <- ppoints(n) p <- p[pmin(p, 1-p) < cut] q <- pt(seq(qt(cut,df=19),qt(1-cut,df=19),length=m),df=19) sort(c(p,q)) } then adding 'f.value=fn' to your qqmath arguments? This essentially says, plot the individual data points in the extreme tails of the distribution (p < 0.001 or p > 0.999), and evaluate the distribution at a sparse set of points in between, where the density means you can't discern the individual values anyway. -- Dave