Files
civilyticsR/man/civilytics_logo.Rd
T
jared 099fff1d1d
R-CMD-check / R CMD check (push) Successful in 2m46s
fix: correct pipe precedence docs — |> binds tighter than +
R's |> has higher precedence than +, so parentheses ARE required
around the ggplot chain before piping to civilytics_logo():

  (ggplot(df, aes(x, y)) + geom_point() + theme_civilytics()) |>
    civilytics_logo()

Updated docs, examples, and pipe test accordingly.
2026-05-17 22:54:53 -06:00

64 lines
1.5 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logo.R
\name{civilytics_logo}
\alias{civilytics_logo}
\title{Add a Civilytics logo to a ggplot (pipe-friendly)}
\usage{
civilytics_logo(
plot,
type = c("wordmark", "mark"),
variant = c("light", "dark"),
margin_param = NULL
)
}
\arguments{
\item{plot}{A ggplot object.}
\item{type}{Character. `"wordmark"` (default) or `"mark"`. Passed to
[make_logo_grob()].}
\item{variant}{Character. `"light"` (default) or `"dark"`. Passed to
[make_logo_grob()].}
\item{margin_param}{Numeric or `NULL`. Manual margin adjustment passed to
[add_logo()].}
}
\value{
A grob (from [gridExtra::arrangeGrob()]) ready to draw with
[grid::grid.draw()].
}
\description{
A convenience wrapper that creates the logo grob and attaches it below the
plot in one call. Designed for use with the base pipe `|>`.
}
\details{
**Important:** R's `|>` has *higher* precedence than `+`, so you must
wrap the ggplot chain in parentheses before piping:
```
(ggplot(mpg, aes(displ, hwy)) +
geom_point() +
theme_civilytics()) |>
civilytics_logo()
```
}
\examples{
\dontrun{
library(ggplot2); library(grid)
# Pipe usage — parentheses required around the ggplot chain
(ggplot(mpg, aes(displ, hwy)) +
geom_point() +
theme_civilytics()) |>
civilytics_logo() |>
grid.draw()
# Dark theme with mark
(ggplot(mpg, aes(displ, hwy)) +
geom_point() +
theme_civilytics_dark()) |>
civilytics_logo(variant = "dark", type = "mark") |>
grid.draw()
}
}