Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Create a new data frame with the faceting variable(s), and a
value to use in each facet. Then use geom_text() with the new data frame (Figure 7-17):
# The base plotp<-ggplot(mpg,aes(x=displ,y=hwy))+geom_point()+facet_grid(.~ drv)# A data frame with labels for each facetf_labels<-data.frame(drv=c("4","f","r"),label=c("4wd","Front","Rear"))p+geom_text(x=6,y=40,aes(label=label),data=f_labels)# If you use annotate(), the label will appear in all facetsp+annotate("text",x=6,y=42,label="label text")