| theme_brand_ggplot2 | R Documentation |
Create a ggplot2 theme using explicit colors or by automatically extracting colors from a brand.yml file.
theme_brand_ggplot2(
brand = NULL,
background = NULL,
foreground = NULL,
accent = NULL,
...,
base_size = 11,
title_size = base_size * 1.2,
title_color = NULL,
line_color = NULL,
rect_fill = NULL,
text_color = NULL,
plot_background_fill = NULL,
panel_background_fill = NULL,
panel_grid_major_color = NULL,
panel_grid_minor_color = NULL,
axis_text_color = NULL,
plot_caption_color = NULL
)
brand |
One of:
|
background |
The background color, defaults to |
foreground |
The foreground color, defaults to |
accent |
The accent color, defaults to |
... |
Reserved for future use. |
base_size |
Base font size in points. Used for the |
title_size |
Title font size in points. Used for the |
title_color |
Color for the |
line_color |
Color for the |
rect_fill |
Fill color for the |
text_color |
Color for the |
plot_background_fill |
Fill color for the |
panel_background_fill |
Fill color for the |
panel_grid_major_color |
Color for the |
panel_grid_minor_color |
Color for the |
axis_text_color |
Color for the |
plot_caption_color |
Color for the |
A ggplot2::theme() object.
The theme_brand_* functions can be used in two ways:
With a brand.yml file: The theme_brand_* functions use
read_brand_yml() to automatically detect and use a _brand.yml file in
your current project. You can also explicitly pass a path to a brand.yml
file or a brand object (as returned by read_brand_yml() or created with
as_brand_yml()). When a brand is provided, the theme functions will
use the colors defined in the brand file automatically.
With explicit colors: You can directly provide colors to override the
default brand colors, or you can use brand = FALSE to ignore any project
_brand.yml files and only use the explicitly provided colors.
Other branded theming functions:
theme_brand_flextable(),
theme_brand_gt(),
theme_brand_plotly(),
theme_brand_thematic()
brand <- as_brand_yml('
color:
palette:
black: "#1A1A1A"
white: "#F9F9F9"
orange: "#FF6F20"
foreground: black
background: white
primary: orange')
library(ggplot2)
ggplot(diamonds, aes(carat, price)) +
geom_point() +
theme_brand_ggplot2(brand)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.