patch_titles {ggalign} | R Documentation |
Add patch titles to plot borders
Description
This function extends ggplot2's title functionality, allowing you to add titles to each border of the plot: top, left, bottom, and right.
Usage
patch_titles(
top = waiver(),
left = waiver(),
bottom = waiver(),
right = waiver()
)
Arguments
top , left , bottom , right |
A string specifying the title to be added to the top, left, bottom, and right border of the plot. |
Details
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).
Value
A labels
object to be added to ggplot.
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"
)