Skip to content
Prev 192685 / 398498 Next

Size of plots in pdf files#can it be smaller?

Hi,

I've got a trial version of a thinScatter() function that
(down-)samples 2d-scatter plots while preserving the empirical density
distribution.  You can grab it by:

source("http://www.braju.com/R/hbLite.R");
hbLite("scatterPlots");

Example from example(thinScatter):

library("scatterPlots");

# Sample scatter data
n <- 10e3
x <- rnorm(n=n)
y <- rnorm(n=n)
xy <- cbind(x=x, y=sin(x)+y/5)

layout(matrix(1:4, nrow=2, byrow=TRUE))
par(mar=c(5,4,2,1))

# Plot data
plot(xy, pch=1)

# Thin scatter data by subsampling
rhos <- c(1/3, 1/4, 1/6)
for (kk in seq(along=rhos)) {
  xy2 <- thinScatter(xy, size=rhos[kk])
  points(xy2, pch=1, col=kk+1)
  title <- paste(sprintf("%.1f%%", 100*c(1, rhos)), collapse=", ")
  mtext(side=3, line=0, paste("Densities:", title))
}

for (kk in seq(along=rhos)) {
  xy2 <- thinScatter(xy, size=rhos[kk])
  plot(xy2, pch=1, col=kk+1)
  mtext(side=3, line=0, sprintf("Density: %.1f%% [n=%d]",
100*rhos[kk], nrow(xy2)))
}

If the mailing list allows it, a PNG is attached.

/Henrik
On Mon, Sep 7, 2009 at 1:50 PM, Philipp Pagel<p.pagel at wzw.tum.de> wrote:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: thinScatter,Rex.png
Type: image/png
Size: 19567 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090907/9a0a0274/attachment-0002.png>