[R] determining the order in which points are plotted

Peter Ehlers ehlers at ucalgary.ca
Tue Jan 25 02:31:21 CET 2011


On 2011-01-24 16:39, Mike Miller wrote:
> 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.

10 x 10 strikes me as pretty near the limit of usefulness of
a pairs plot. You might want to investigate the xysplom()
function in pkg:HH. You'll have to write your own panel
function, possibly subsetting your data with the scale()
function.

Peter Ehlers

>
> 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