This function extends ggplot2's title functionality, allowing you to add titles to each border of the plot: top, left, bottom, and right.
Value
A labels object to be added to ggplot.
Details
You can also use labs() to specify the titles (use arguments
"top"
, "left"
, "bottom"
, and "right"
) for the top, left, bottom, and right borders of the
plot.
The appearance and alignment of these patch titles can be customized using theme():
plot.patch_title
/plot.patch_title.*
: Controls the text appearance of patch titles. By default,plot.patch_title
inherit fromplot.title
, and settings for each border will inherit fromplot.patch_title
, with the exception of theangle
property, which is not inherited.plot.patch_title.position
/plot.patch_title.position.*
: Determines the alignment of the patch titles. By default,plot.patch_title.position
inherit fromplot.title.position
, and settings for each border will inherit fromplot.patch_title
. The value"panel"
aligns the patch titles with the plot panels. Setting this to"plot"
aligns the patch title with the entire plot (excluding margins and plot tags).
Examples
ggplot(mtcars) +
geom_point(aes(mpg, disp)) +
patch_titles(
top = "I'm top patch title",
left = "I'm left patch title",
bottom = "I'm bottom patch title",
right = "I'm right patch title"
)