[R] determining the order in which points are plotted

Mike Miller mbmiller+l at gmail.com
Tue Jan 25 00:49:23 CET 2011

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.

I would like to guarantee that point that are far from the centroid for 
their group are plotted last.  This way they will be visible because they 
won't be buried under a pile of points from another group.

As it stands, it looks like scatterplot.matrix (and maybe other plotting 
functions) lay down a group at a time, in order, so that the first group 
is most likely to be buried under later groups.  I try to sort factor 
levels so that the biggest groups go first, and that helps a little, but 
it isn't the complete solution I'm looking for.

Thanks in advance.


Michael B. Miller, Ph.D.
Minnesota Center for Twin and Family Research
Department of Psychology
University of Minnesota

More information about the R-help mailing list