# [R] determining the order in which points are plotted

Greg Snow Greg.Snow at imail.org
Tue Jan 25 18:53:06 CET 2011

```With large numbers of points you might want to consider hexagonal binning instead of scatter plots.  I don't know of any tools that both do the binning and take groups into account, but you could think it through and work something out.

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Mike Miller
> Sent: Monday, January 24, 2011 5:39 PM
> To: David Winsemius
> Cc: R-Help List
> Subject: Re: [R] determining the order in which points are plotted
>
> On Mon, 24 Jan 2011, David Winsemius wrote:
>
> > On Jan 24, 2011, at 6:49 PM, Mike Miller wrote:
> >
> >> I make plenty of scatterplots, especially using scatterplot.matrix
> from
> >> library(car).  One thing I don't know how to do is determine which
> >> points are plotted last.  Sometimes I plot a large number of points
> for
> >> multiple groups represented by different colors.
> >
> > ?points
>
>
> Thanks for the tip.  I guess I would make vectors for x, y and col in
> the
> desired order and the first elements would be plotted first:
>
>     Graphical parameters ‘pch’, ‘col’, ‘bg’, ‘cex’ and ‘lwd’ can be
>     vectors (which will be recycled as needed) giving a value for each
>     point plotted.  If lines are to be plotted (e.g. for ‘type = "b"’/
>     the first element of ‘lwd’ is used.
>
> Suppose I'm plotting 10,000 points in a 10 x 10 scatterplot matrix
> (roughly what I'm actually doing).  That's a total of 1 million points.
> It might take a while, but I can wait.  However, I'm not sure how to
> get
> the coordinates right for additional points in a scatterplot matrix.
> Maybe I need to study that source code.
>
> I did figure out recently how to use transparent points to get the axes
> right.  Color "#ffffff00" does that trick for me -- that's white color
> with zero opaqueness, full transparency.
>
> Mike
>
> --
> Michael B. Miller, Ph.D.
> Minnesota Center for Twin and Family Research
> Department of Psychology
> University of Minnesota

```