[R] pch="." plots much faster

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue May 13 14:08:15 CEST 2008


On Tue, 13 May 2008, Charles Plessy wrote:

> Dear list,
>
> I realised by chance when analysing a 1521862 × 8 matrix that plotting
> was much faster when using "." as the argument of `pch'.

Why is that surprising?  Drawing a small square is rather easy compared to 
a circle, say.

> I was just wondering if there were other ways to get this speed 
> improvement: it is otherwise quite difficult to explore such big 
> matrices, especially given that X11 redraws the plot whenever its window 
> is covered/uncovered by another window, or when I switch virtual 
> desktops.

That is a function of your X setup.  R does ask for backing store to be 
used, and so it seeems your setup is not doing so. Also, the type="cairo" 
in X11() will repaint from a backing pixmap.

You might want to contemplate better ways to visualize 1.5m points.  It is 
not clear what plot you are actually doing, but a density plot is likely 
to be more informative (especially a 2D pairs plot of densities), or a 
hexbin plot (from the BioC package or that name) or ....

>
> Best regards,
>
> -- 
> Charles Plessy,
> Wakō, Saitama, Japan
>
> ______________________________________________
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list