The logo gets its own band (logo_height inches) instead of negative margins, so captions are no longer clipped. Patchwork compositions go through patchworkGrob() so every panel survives. font_scale defaults to 1. make_logo_grob() sizes by height so the logo keeps its shape on any canvas. Closes #20 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
45 lines
1.4 KiB
R
45 lines
1.4 KiB
R
% Generated by roxygen2: do not edit by hand
|
|
% Please edit documentation in R/logo.R
|
|
\name{add_logo}
|
|
\alias{add_logo}
|
|
\title{Add a logo to a ggplot2 object}
|
|
\usage{
|
|
add_logo(
|
|
plot,
|
|
logo,
|
|
margin_param = NULL,
|
|
font_scale = 1,
|
|
position = c("bottom-right", "bottom-left", "top-right", "top-left"),
|
|
logo_height = 0.5
|
|
)
|
|
}
|
|
\arguments{
|
|
\item{plot}{a ggplot2 object, or a patchwork composition}
|
|
|
|
\item{logo}{a logo grob created by make_logo_grob()}
|
|
|
|
\item{margin_param}{Optional numeric. Replaces the plot margin (in points)
|
|
on the side next to the logo. `NULL` (default) leaves the plot's margins
|
|
alone.}
|
|
|
|
\item{font_scale}{Numeric. Multiplicative scaling factor applied to the
|
|
base text size before composing. Default `1` leaves typography unchanged.}
|
|
|
|
\item{position}{Character. Corner placement for the logo: `"bottom-right"`
|
|
(default), `"bottom-left"`, `"top-right"`, or `"top-left"`. Controls
|
|
whether the logo is placed above or below the plot.}
|
|
|
|
\item{logo_height}{Numeric. Height in inches of the band reserved for the
|
|
logo. Default `0.5`.}
|
|
}
|
|
\value{
|
|
a grob with a logo attached to it ready to plot
|
|
}
|
|
\description{
|
|
The logo gets its own band of reserved height (`logo_height`, in inches)
|
|
below or above the plot, so it cannot overlap the plot's caption or push
|
|
anything off the canvas. Patchwork compositions are converted with
|
|
[patchwork::patchworkGrob()] so every panel and the
|
|
[patchwork::plot_annotation()] survive.
|
|
}
|