Skip to content

Adding text to plot(dataframe)

2 messages · Ken Termiso, Bert Gunter

#
Hello,

When using the plot(df) command, which scatter plots every variable of the 
df against every other variable, I would like to add text labels, but cannot 
find how to do this in this case so that every little sub-plot in the window 
has text labels on the points...

Any help would be much appreciated.

Thanks,
Ken
#
As usual, please read the docs (?plot.data.frame)! There you will find a
link to pairs() among whose arguments is "panel" for writing your own panel
function. In this panel function you can use low level plotting and text
functions like points() and text() to customize what is plotted. Look at the
code for pairs to see how.

Alternatively, and better IMHO, is to use trellis plotting. ?splom (assuming
the lattice package is loaded).

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box