[R] 2d plot with modification of plotting symbol to indicate third dimension.

Duncan Murdoch murdoch.duncan at gmail.com
Thu Jan 13 06:11:17 CET 2011


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



More information about the R-help mailing list