R-CMD-check / R CMD check (push) Successful in 2m39s
- Replace old civilytics_logo.png/white.png/jpg/pdf with new rebrand
assets: civilytics-wordmark.png, civilytics-wordmark-reverse.png,
civilytics-mark.png, civilytics-mark-reverse.png (all transparent bg)
- make_logo_grob() now accepts type = c("wordmark", "mark") alongside
variant = c("light", "dark") for 4 combinations
- New civilytics_logo() pipe-friendly convenience function:
ggplot(df, aes(x, y)) + geom_point() + theme_civilytics() |>
civilytics_logo()
R's |> has lower precedence than +, so the full ggplot chain pipes
through without parentheses
- Remove old icon/favicon assets no longer used
- Wrap showtext-dependent examples in \dontrun{} to prevent R CMD check
failures in headless PostScript environments
64 lines
1.4 KiB
R
64 lines
1.4 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{
|
|
```
|
|
ggplot(mpg, aes(displ, hwy)) +
|
|
geom_point() +
|
|
theme_civilytics() |>
|
|
civilytics_logo()
|
|
```
|
|
|
|
Since `|>` has lower precedence than `+`, the entire ggplot chain is piped
|
|
as the first argument — no parentheses needed.
|
|
}
|
|
\examples{
|
|
\dontrun{
|
|
library(ggplot2); library(grid)
|
|
|
|
# Pipe-friendly usage
|
|
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()
|
|
}
|
|
}
|