[R] changing pen mode [or adjusting for overlapping points?]

Spencer Graves spencer.graves at pdf.com
Tue Mar 11 22:37:48 CET 2003


Have you considered plotting the points in a random order?  With 
superimposed points, the color of the last point plotted is what appears.

Spencer Graves

Marc Schwartz wrote:
>>-----Original Message-----
>>From: r-help-bounces at stat.math.ethz.ch 
>>[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Don Armstrong
>>Sent: Tuesday, March 11, 2003 2:08 PM
>>To: r-help at stat.math.ethz.ch
>>Subject: [R] changing pen mode [or adjusting for overlapping points?]
>>
>>
>>I'm ploting a rather large number of points [~24,000] in two 
>>series with slightly different distributions.
>>
>>I would like to be able to effectively see where the two 
>>distributions overlap by setting the pen mode (or it's 
>>equivalent) to allow the overlapping portion to show up as a 
>>different color (or different shade).
>>
>>Unfortunatly, I couldn't find an option in par or postscript 
>>that looks like it would be of use.
>>
>>Ideas or suggestions?
>>
>>
>>Don Armstrong
> 
> 
> I may be mis-understanding what you are trying to do, but if you are
> using plot() to generate a scatter plot (as opposed to a density plot)
> and there are actual overlapping points between the two sets, you
> could use jitter() to introduce some random noise into the plotted
> points.
> 
> Something like this might work, presuming that (x1, y1) and (x2, y2)
> are your two sets of points:
> 
> 
>>plot(x1, y1, pch = 16, col = "red")
>>points(jitter(x2), jitter(y2), pch = 16, col = "blue")
> 
> 
> The first plot() draws the initial set of data and points() adds the
> second set of data to the same plot, but in a different color with
> some random noise added to the points.
> 
> If that is not what you need, let us know.
> 
> Marc Schwartz
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help



More information about the R-help mailing list