| Title: | Anthropic and Claude Inspired 'ggplot2' Themes and Color Scales |
|---|---|
| Description: | A 'ggplot2' extension that brings the visual language of Anthropic and Claude to R. Provides a publication-ready theme, qualitative, sequential, and diverging color palettes drawn from Anthropic's brand and data-visualization style, discrete and continuous color and fill scales, and palette display helpers. The package bundles Anthropic's recommended open typefaces ('Poppins' for headings and 'Lora' for body text) and registers them automatically when 'systemfonts' is available. |
| Authors: | Vinicius Oike [aut, cre, cph] (ORCID: <https://orcid.org/0009-0005-8015-9189>) |
| Maintainer: | Vinicius Oike <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-20 15:48:20 UTC |
| Source: | https://github.com/viniciusoike/claudeplot |
A named character vector of the core colors used across Anthropic's brand
and Claude's data-visualization style. Brand neutrals and accents follow
Anthropic's published brand guidelines; the vivid accents (viz_*) match
the saturated colors used in Claude's benchmark charts.
claude_colorsclaude_colors
A named character vector of hex color strings.
claude_colors["orange"] unname(claude_colors[c("viz_green", "viz_blue", "viz_pink")])claude_colors["orange"] unname(claude_colors[c("viz_green", "viz_blue", "viz_pink")])
Prints whether the bundled Anthropic typefaces (Poppins and Lora) are
available to render and whether the optional ragg and systemfonts
packages are installed. Useful for diagnosing why theme_claude() falls
back to generic fonts.
claude_font_status()claude_font_status()
Invisibly, a named list with logical entries poppins, lora,
systemfonts, and ragg.
claude_font_status()claude_font_status()
Low-level palette generator used internally by the scale functions. Most
users will prefer claude_palette() (which returns a printable object) or
the scale_*_claude_*() functions.
claude_pal( palette = "claude", n = NULL, type = c("discrete", "continuous"), reverse = FALSE )claude_pal( palette = "claude", n = NULL, type = c("discrete", "continuous"), reverse = FALSE )
palette |
Name of a palette. See |
n |
Number of colors to return. Defaults to the full palette for discrete palettes, or all anchor colors for continuous palettes. |
type |
Either |
reverse |
Logical; reverse the color order? |
A character vector of hex colors.
claude_pal("claude", n = 3) claude_pal("oranges", n = 9, type = "continuous")claude_pal("claude", n = 3) claude_pal("oranges", n = 9, type = "continuous")
Returns the colors of a palette as a claude_palette object, which prints
as a color swatch (via scales::show_col()).
claude_palette( palette = "claude", n = NULL, type = c("discrete", "continuous"), reverse = FALSE )claude_palette( palette = "claude", n = NULL, type = c("discrete", "continuous"), reverse = FALSE )
palette |
Name of a palette. See |
n |
Number of colors to return. Defaults to the full palette for discrete palettes, or all anchor colors for continuous palettes. |
type |
Either |
reverse |
Logical; reverse the color order? |
A character vector of hex colors with class claude_palette.
show_claude_palette() and show_claude_palettes() for plots.
claude_palette("claude") claude_palette("oranges", n = 9, type = "continuous")claude_palette("claude") claude_palette("oranges", n = 9, type = "continuous")
List available claudeplot palettes
claude_palette_names(type = c("all", "qualitative", "sequential", "diverging"))claude_palette_names(type = c("all", "qualitative", "sequential", "diverging"))
type |
One of |
A character vector of palette names (invisible side effects: none).
claude_palette_names() claude_palette_names("sequential")claude_palette_names() claude_palette_names("sequential")
Discrete (_d) and continuous (_c) color and fill scales built from the
claudeplot palettes. The British spelling (colour) aliases are provided
for every American (color) scale.
scale_color_claude_d(palette = "claude", reverse = FALSE, ...) scale_colour_claude_d(palette = "claude", reverse = FALSE, ...) scale_fill_claude_d(palette = "claude", reverse = FALSE, ...) scale_color_claude_c(palette = "oranges", reverse = FALSE, ...) scale_colour_claude_c(palette = "oranges", reverse = FALSE, ...) scale_fill_claude_c(palette = "oranges", reverse = FALSE, ...)scale_color_claude_d(palette = "claude", reverse = FALSE, ...) scale_colour_claude_d(palette = "claude", reverse = FALSE, ...) scale_fill_claude_d(palette = "claude", reverse = FALSE, ...) scale_color_claude_c(palette = "oranges", reverse = FALSE, ...) scale_colour_claude_c(palette = "oranges", reverse = FALSE, ...) scale_fill_claude_c(palette = "oranges", reverse = FALSE, ...)
palette |
Name of a palette. Discrete scales default to |
reverse |
Logical; reverse the palette order? |
... |
Passed to |
A ggplot2 scale object.
library(ggplot2) ggplot(mtcars, aes(wt, mpg, color = factor(gear))) + geom_point() + scale_color_claude_d() ggplot(faithfuld, aes(waiting, eruptions, fill = density)) + geom_raster() + scale_fill_claude_c(palette = "blues")library(ggplot2) ggplot(mtcars, aes(wt, mpg, color = factor(gear))) + geom_point() + scale_color_claude_d() ggplot(faithfuld, aes(waiting, eruptions, fill = density)) + geom_raster() + scale_fill_claude_c(palette = "blues")
Draws one palette as a row of labelled color swatches.
show_claude_palette( palette = "claude", n = NULL, type = c("discrete", "continuous"), reverse = FALSE, labels = TRUE )show_claude_palette( palette = "claude", n = NULL, type = c("discrete", "continuous"), reverse = FALSE, labels = TRUE )
palette |
Name of a palette. See |
n |
Number of colors to return. Defaults to the full palette for discrete palettes, or all anchor colors for continuous palettes. |
type |
Either |
reverse |
Logical; reverse the color order? |
labels |
Logical; overlay hex codes on each swatch? |
A ggplot object (invisibly), drawn as a side effect.
show_claude_palettes() to display every palette at once.
show_claude_palette("claude") show_claude_palette("oranges", n = 7, type = "continuous")show_claude_palette("claude") show_claude_palette("oranges", n = 7, type = "continuous")
Draws every palette (optionally filtered by type) as a stacked grid of color swatches.
show_claude_palettes(type = c("all", "qualitative", "sequential", "diverging"))show_claude_palettes(type = c("all", "qualitative", "sequential", "diverging"))
type |
One of |
A ggplot object (invisibly), drawn as a side effect.
show_claude_palette() to display one palette in detail.
show_claude_palettes() show_claude_palettes("sequential")show_claude_palettes() show_claude_palettes("sequential")
A clean, publication-ready theme modelled on the data visualizations in
Anthropic's model reports: a light background, light horizontal grid lines,
strong black axis lines, a bold geometric-sans title (Poppins), and a serif
subtitle (Lora). Custom fonts render on ragg/svglite devices; when the
bundled fonts are unavailable the theme falls back to generic families.
theme_claude( base_size = 12, font_title = "Poppins", font_text = "Poppins", font_subtitle = "Lora", grid = c("y", "x", "xy", "none"), axis_lines = TRUE, background = "white", ... )theme_claude( base_size = 12, font_title = "Poppins", font_text = "Poppins", font_subtitle = "Lora", grid = c("y", "x", "xy", "none"), axis_lines = TRUE, background = "white", ... )
base_size |
Base font size in points. |
font_title |
Family for the plot title. Defaults to Poppins (with a
|
font_text |
Family for axis, legend, and other text. Defaults to
Poppins (with a |
font_subtitle |
Family for the subtitle and caption. Defaults to Lora
(with a |
grid |
Which major grid lines to draw: |
axis_lines |
Logical; draw strong axis lines and ticks on the left and
bottom? Defaults to |
background |
Panel and plot background fill. Use |
... |
Passed to |
The bundled Poppins and Lora fonts only render on ragg or svglite
devices. On the base PDF/PostScript device (used by R CMD check) custom
fonts are unavailable, so the examples below pass generic families. In your
own work, omit the font_* arguments to use the Anthropic typefaces and
save with a ragg device, e.g.
ggsave("plot.png", device = ragg::agg_png).
A ggplot2 theme object.
library(ggplot2) # Generic fonts keep the example device-agnostic. ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) + geom_point(size = 3) + labs( title = "Fuel efficiency by weight", subtitle = "Heavier cars travel fewer miles per gallon", color = "Cylinders" ) + scale_color_claude_d() + theme_claude(font_title = "sans", font_text = "sans", font_subtitle = "serif") ## Not run: # With the bundled Anthropic fonts (requires systemfonts + a ragg device): ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) + geom_point(size = 3) + theme_claude() ## End(Not run)library(ggplot2) # Generic fonts keep the example device-agnostic. ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) + geom_point(size = 3) + labs( title = "Fuel efficiency by weight", subtitle = "Heavier cars travel fewer miles per gallon", color = "Cylinders" ) + scale_color_claude_d() + theme_claude(font_title = "sans", font_text = "sans", font_subtitle = "serif") ## Not run: # With the bundled Anthropic fonts (requires systemfonts + a ragg device): ggplot(mtcars, aes(wt, mpg, color = factor(cyl))) + geom_point(size = 3) + theme_claude() ## End(Not run)