[R] determining the order in which points are plotted

Mike Miller mbmiller+l at gmail.com
Tue Jan 25 01:39:17 CET 2011


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


More information about the R-help mailing list