Graphics Reference
In-Depth Information
Figure 7-9. Lines with a discrete axis
NOTE
You may have noticed that adding lines differs from adding other annotations. Instead of using the
an-
notate()
function, we've used
geom_hline()
and friends. This is because previous versions of ggplot2
didn't have the
annotate()
function. The line geoms had code to handle the special cases where they
were used to add a single line, and changing it would break backward compatibility. In a future version
of ggplot2, this will change, and
annotate()
will work with line geoms.
See Also
For adding regression lines, see Recipes
Adding Fitted Regression Model Lines
and .
Lines are often used to indicate summarized information about data. See
Summarizing Data by
Groups
for more on how to summarize data by groups.