On Thu, 13 Jan 2011, Bert Gunter wrote:
Duncan:
I must humbly disagree. Here's the problem: in order to accurately
represent the value, the "point" = circle _area_ must be proportional
to the value. That is, the eye "sees" the areas, not the radii, as the
point "size." A delightful reference on this is Howard Wainer's 1982
or so (can't remember exactly) article in THE AMERICAN STATISTICIAN,
"How to Graph Data Badly" (or maybe "Plot" Data).
('Display' Data, 1984).
In a pseudo-3D plot, such as scatter3dplot, size perception can be
even more complex.
Anyway, using cex, I have no idea whether a point drawn with cex =
1.23 is 1.23 times the area or radius -- or neither -- of a point
drawn with cex =1. Indeed, it might vary depending on the
implementation/OS/graphics fonts.
It will be approximately 1.23 times the radius. For the default pch=1
(and we seem to be talking about circles), in the graphics devices
points() and symbols() will call the same graphics primitives for
circles. Now circles will have their sizes rounded to something,
maybe the nearest pixel, maybe 0.01bp, maybe something else, so you
may not have much control over very small circles, but you will over
those of diameter about 5mm or more.
So it seems better to me to "draw" the point with symbols(), where
you can have complete control over the size.
In some ways this goes back to S, where AFAIR (and ?points suggest)
pch=1 was an octagon and symbols() was the only way to draw circles.
Obviously, let me know if I'm wrong about this.
Cheers,
Bert
On Wed, Jan 12, 2011 at 9:11 PM, Duncan Murdoch
<murdoch.dun...@gmail.com> wrote:
On 11-01-12 9:33 PM, John Sorkin wrote:
I would like to plot 3-dimensional data on a two-dimensional scatter-plot.
Is there a way I can automatically modify the plot symbol (e.g. changing
size or color) to indicate the value of a third variable? E.g. How can I
plot weight vs. age and indicate the value of muscle mass for each value
weight-age pair by making the plot point proportional to the subject's
muscle mass?
Just set cex to the other variable. For example,
plot(1:10, 1:10, cex=1:10)
Similarly, col and pch can be set to vector values, which are recycled
through the points.
Duncan Murdoch
--
Bert Gunter
Genentech Nonclinical Biostatistics
467-7374
http://devo.gene.com/groups/devo/depts/ncb/home.shtml
--
Brian D. Ripley, rip...@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.