R-CMD-check / R CMD check (push) Successful in 3m36s
- Change rel_large default from 16/14 to 20/14 (~1.43x) to match the Civilytics editorial design system. Subtitle now renders at 1.0x base instead of 0.86x. - Switch axis.text to rel() sizing so all text elements cascade from the root font_size, enabling uniform scaling. - Add font_scale parameter (default 1.1) to civilytics_logo(), add_logo(), and add_logo_ga() — inflates text by ~10% before arrangeGrob composition to compensate for viewport shrinkage. - Ship SVG logo variants (mark, wordmark, pulse) in inst/img/ for Quarto/HTML templates. - Add "Maintaining brand assets" section to README documenting inst/img/ file inventory and update workflow. - Document full font size hierarchy in theme_civilytics() roxygen.
76 lines
1.8 KiB
R
76 lines
1.8 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,
|
|
font_scale = 1.1
|
|
)
|
|
}
|
|
\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()].}
|
|
|
|
\item{font_scale}{Numeric. Inflate text sizes by this factor to compensate
|
|
for viewport shrinkage when composing with [gridExtra::arrangeGrob()].
|
|
Default `1.1` (~10 \% inflation). Set to `1` to disable.}
|
|
}
|
|
\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()
|
|
|
|
# Disable font inflation
|
|
(ggplot(mpg, aes(displ, hwy)) +
|
|
geom_point() +
|
|
theme_civilytics()) |>
|
|
civilytics_logo(font_scale = 1) |>
|
|
grid.draw()
|
|
}
|
|
}
|