Package 'claudeplot'

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

Help Index


Anthropic and Claude brand colors

Description

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.

Usage

claude_colors

Format

A named character vector of hex color strings.

Examples

claude_colors["orange"]
unname(claude_colors[c("viz_green", "viz_blue", "viz_pink")])

Report claudeplot font status

Description

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.

Usage

claude_font_status()

Value

Invisibly, a named list with logical entries poppins, lora, systemfonts, and ragg.

Examples

claude_font_status()

Generate colors from a claudeplot palette

Description

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.

Usage

claude_pal(
  palette = "claude",
  n = NULL,
  type = c("discrete", "continuous"),
  reverse = FALSE
)

Arguments

palette

Name of a palette. See claude_palette_names().

n

Number of colors to return. Defaults to the full palette for discrete palettes, or all anchor colors for continuous palettes.

type

Either "discrete" or "continuous". For "continuous", colors are interpolated with grDevices::colorRampPalette().

reverse

Logical; reverse the color order?

Value

A character vector of hex colors.

Examples

claude_pal("claude", n = 3)
claude_pal("oranges", n = 9, type = "continuous")

Build a claudeplot palette object

Description

Returns the colors of a palette as a claude_palette object, which prints as a color swatch (via scales::show_col()).

Usage

claude_palette(
  palette = "claude",
  n = NULL,
  type = c("discrete", "continuous"),
  reverse = FALSE
)

Arguments

palette

Name of a palette. See claude_palette_names().

n

Number of colors to return. Defaults to the full palette for discrete palettes, or all anchor colors for continuous palettes.

type

Either "discrete" or "continuous". For "continuous", colors are interpolated with grDevices::colorRampPalette().

reverse

Logical; reverse the color order?

Value

A character vector of hex colors with class claude_palette.

See Also

show_claude_palette() and show_claude_palettes() for plots.

Examples

claude_palette("claude")
claude_palette("oranges", n = 9, type = "continuous")

List available claudeplot palettes

Description

List available claudeplot palettes

Usage

claude_palette_names(type = c("all", "qualitative", "sequential", "diverging"))

Arguments

type

One of "all", "qualitative", "sequential", or "diverging".

Value

A character vector of palette names (invisible side effects: none).

Examples

claude_palette_names()
claude_palette_names("sequential")

Claude color and fill scales for ggplot2

Description

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.

Usage

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, ...)

Arguments

palette

Name of a palette. Discrete scales default to "claude" (the vivid benchmark palette); continuous scales default to "oranges". See claude_palette_names().

reverse

Logical; reverse the palette order?

...

Passed to ggplot2::discrete_scale(), ggplot2::scale_color_gradientn(), or ggplot2::scale_fill_gradientn().

Value

A ggplot2 scale object.

Examples

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")

Display a single claudeplot palette

Description

Draws one palette as a row of labelled color swatches.

Usage

show_claude_palette(
  palette = "claude",
  n = NULL,
  type = c("discrete", "continuous"),
  reverse = FALSE,
  labels = TRUE
)

Arguments

palette

Name of a palette. See claude_palette_names().

n

Number of colors to return. Defaults to the full palette for discrete palettes, or all anchor colors for continuous palettes.

type

Either "discrete" or "continuous". For "continuous", colors are interpolated with grDevices::colorRampPalette().

reverse

Logical; reverse the color order?

labels

Logical; overlay hex codes on each swatch?

Value

A ggplot object (invisibly), drawn as a side effect.

See Also

show_claude_palettes() to display every palette at once.

Examples

show_claude_palette("claude")
show_claude_palette("oranges", n = 7, type = "continuous")

Display all available claudeplot palettes

Description

Draws every palette (optionally filtered by type) as a stacked grid of color swatches.

Usage

show_claude_palettes(type = c("all", "qualitative", "sequential", "diverging"))

Arguments

type

One of "all", "qualitative", "sequential", or "diverging".

Value

A ggplot object (invisibly), drawn as a side effect.

See Also

show_claude_palette() to display one palette in detail.

Examples

show_claude_palettes()
show_claude_palettes("sequential")

Anthropic and Claude inspired ggplot2 theme

Description

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.

Usage

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",
  ...
)

Arguments

base_size

Base font size in points.

font_title

Family for the plot title. Defaults to Poppins (with a "sans" fallback).

font_text

Family for axis, legend, and other text. Defaults to Poppins (with a "sans" fallback).

font_subtitle

Family for the subtitle and caption. Defaults to Lora (with a "serif" fallback).

grid

Which major grid lines to draw: "y" (default), "x", "xy", or "none".

axis_lines

Logical; draw strong axis lines and ticks on the left and bottom? Defaults to TRUE.

background

Panel and plot background fill. Use "white" (default) or "cloud" for Anthropic's warm off-white, or any color string.

...

Passed to ggplot2::theme_minimal().

Details

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).

Value

A ggplot2 theme object.

Examples

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)