Package: ggspec 0.1.0

Clement Lee

ggspec: Extract and Compare 'ggplot2' Plot Specifications as Tidy Data Frames

Inspects 'ggplot' objects by extracting their full declarative specification - layers, aesthetic mappings, scales, facets, coordinate systems, and labels - as tidy data frames. A second tier of functions enables structural comparison of two 'ggplot' objects, supporting automated plot testing, auditing, and framework-agnostic grading workflows. Unlike 'ggcheck', which is designed exclusively for 'learnr'/'gradethis' pipelines and returns ad-hoc objects, 'ggspec' returns rectangular, pipeable output and does not require any grading framework as a dependency.

Authors:Clement Lee [aut, cre]

ggspec_0.1.0.tar.gz
ggspec_0.1.0.tar.gz(r-4.7-any)ggspec_0.1.0.tar.gz(r-4.6-any)
ggspec_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
ggspec/json (API)
NEWS

# Install 'ggspec' in R:
install.packages('ggspec', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/clement-lee/ggspec/issues

On CRAN:

Conda:

3.18 score 30 exports 25 dependencies

Last updated from:14f2da794f. Checks:4 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK187
source / vignettesOK193
linux-release-x86_64OK146
wasm-releaseOK151

Exports:assert_ggplotcanoncheck_plotcompare_conceptualcompare_plotscompare_visualenrich_specequiv_aesequiv_coordequiv_dataequiv_facetsequiv_labelsequiv_layersequiv_paramsequiv_plotequiv_renderedequiv_scalesexpect_equiv_plothas_layeris_ggplotmapping_existsn_layersspec_aesspec_coordspec_dataspec_facetsspec_labelsspec_layersspec_plotspec_scales

Dependencies:clicpp11dplyrfarvergenericsggplot2gluegtableisobandlabelinglifecyclemagrittrpillarpkgconfigR6RColorBrewerrlangS7scalestibbletidyselectutf8vctrsviridisLitewithr

Equivalence Patterns and Canonicalisation Modes

Rendered fromequivalence-patterns.Rmdusingknitr::rmarkdownon May 28 2026.

Last update: 2026-05-28
Started: 2026-05-28

Extracting Plot Specifications with ggspec

Rendered fromextracting-specs.Rmdusingknitr::rmarkdownon May 28 2026.

Last update: 2026-05-28
Started: 2026-05-28

Plot Grading and Testing with ggspec

Rendered fromgrading-with-ggspec.Rmdusingknitr::rmarkdownon May 28 2026.

Last update: 2026-05-28
Started: 2026-05-28

Readme and manuals

Help Manual

Help pageTopics
Assert that an object is a ggplotassert_ggplot
Canonicalise a ggplot specificationcanon
Framework-agnostic plot checkcheck_plot
Compare two ggplot objects for conceptual similaritycompare_conceptual
Compare two ggplot objectscompare_plots
Compare two ggplot objects for visual equivalencecompare_visual
Enrich a plot's layer specification with build-derived default informationenrich_spec
Compare aesthetic mappings of two ggplot objectsequiv_aes
Compare coordinate systems of two ggplot objectsequiv_coord
Compare the data of a layer in two ggplot objectsequiv_data
Compare facet specification of two ggplot objectsequiv_facets
Compare labels of two ggplot objectsequiv_labels
Compare layer structure of two ggplot objectsequiv_layers
Compare parameters of a specific layer in two ggplot objectsequiv_params
Compare two ggplot objects across multiple dimensionsequiv_plot
Compare the rendered (built) layer data of two ggplot objectsequiv_rendered
Compare scales of two ggplot objectsequiv_scales
testthat expectation for plot equivalenceexpect_equiv_plot
Test whether a plot contains a given layerhas_layer
Test whether an object is a ggplotis_ggplot
Test whether a specific aesthetic mapping exists in a plotmapping_exists
Count the number of layers in a ggplotn_layers
Extract aesthetic mappings as a long-format tidy data framespec_aes
Extract coordinate system specification as a tidy data framespec_coord
Extract the dataset table for a ggplot objectspec_data
Extract facet specification as a tidy data framespec_facets
Extract plot labels as a tidy data framespec_labels
Extract layer specifications as a tidy data framespec_layers
Extract the full plot specification as a master tidy data framespec_plot
Extract scale specifications as a tidy data framespec_scales