Graphics Reference
In-Depth Information
Figure 5-25. Predictions for each group extend to the full x range of all groups together
Adding Annotations with Model Coefficients
Problem
You want to add numerical information about a model to a plot.
Solution
To add simple text to a plot, simply add an annotation. In this example, we'll create a linear mod-
to create a prediction line from the model. Then we'll add an annotation:
library(gcookbook)
# For the data set
model
<-
lm(heightIn ~ ageYear, heightweight)