
title
and subtitle
to explain the main findings.
It's common to use the caption
to provide information about the
data source.
labs(...)
xlab(label)
ylab(label)
ggtitle(label, subtitle = NULL)
NULL
for no subtitle.name
. I recommend doing that if you're
changing other scale options.
p <- ggplot(mtcars, aes(mpg, wt, colour = cyl)) + geom_point()
p + labs(colour = "Cylinders")
p + labs(x = "New x label")
# The plot title appears at the top-left, with the subtitle
# display in smaller text underneath it
p + labs(title = "New plot title")
p + labs(title = "New plot title", subtitle = "A subtitle")
# The caption appears in the bottom-right, and is often used for
# sources, notes or copyright
p + labs(caption = "(based on data from ...)")
Run the code above in your browser using DataLab