← Back to all sparks
G

ggtrace

ANALYTICS
Velocity0.0

R package ggtrace by yjunechoe — release notes from GitHub.

A debugger for ggplot2's internals, hardening its grip as the internals it traces keep moving.

ggplot2debuggingggprotodeveloper-toolingintrospectionr-package
Current state
ggtrace lets users step inside ggplot2's rendering pipeline — tracing ggproto methods, dumping intermediate state, and snapshotting layer data at each stage via layer_before_stat(), layer_after_stat(), layer_before_geom() and layer_after_scale(). The workflow functions gained short aliases at 0.7.1, and recent releases have gone into making method resolution work on ggproto definitions written in forms the tracer did not originally expect.
Where it's heading
The package matured from raw tracing primitives into named workflows: 0.6.0 added the sublayer snapshot functions and error-context helpers, 0.7.x has been sanding down how reliably those workflows find and evaluate a method. Three consecutive releases in May 2025, two of them minutes apart, all address the same class of failure — one-liner ggproto methods without braces, and inheritance resolution on instances rather than subclasses. That pattern says the remaining bugs are in method introspection, not in the tracing machinery itself.
Prediction
Expect continued fixes to method resolution as ggplot2's ggproto definitions vary, and realignment work when ggplot2 4.x changes internals this package deliberately reaches into. The entries do not signal new workflow functions.

Recent moves

  1. 1y ago

    Brace-less one-liner methods traced gracefully

    Handles tracing of one-liner methods written without braces more gracefully. The third release in two days on the same underlying introspection problem.

    View source ↗
  2. 1y ago

    get_method_inheritance() fixed for class instances

    Fixes get_method_inheritance() failing to simplify an instance of a class rather than a subclass. Stamped four minutes after 0.7.5 — both were cut in one sitting, not as separate release events.

    View source ↗
  3. 1y ago

    Workflow functions recognise one-liner ggproto methods

    Workflow functions now recognise one-liner ggproto methods, which they previously failed to match. A narrow introspection fix that the next two releases extend.

    View source ↗
  4. 1y ago

    Eager layer_is(), clearer method-mismatch errors, consistent tracedump names

    layer_is() evaluates its argument eagerly by default so it can be programmed over, and workflow functions give an informative error when a ggproto method is named on the wrong class — StatCount$compute_layer where Stat$compute_layer was meant. The use_names behaviour for naming tracedump entries is also made consistent across the cases where trace_exprs is supplied or empty.

    View source ↗
  5. 1y ago

    trace_steps = "all" added; double-evaluation side effects fixed

    trace_steps = "all" expands to every step in a method body, and a double-evaluation bug in trace_exprs is fixed by cloning the method environment. The latter matters because re-evaluating a step could trigger side effects the user never asked for.

    View source ↗
  6. 1y ago

    layer_is() targets by_layer() downstream directly

    Adds layer_is(), used by the sublayer inspection functions to target the downstream of by_layer() specifically rather than relying on positional assumptions. That retargeting is what makes those functions survive ggplot2 internals changes.

    View source ↗