Skip to contents

Extracts metadata from a ggplot2 object - geom types, key aesthetic mappings, axis labels, faceting, and color/fill scale names - and returns a plain-text description suitable for use as a figure legend draft.

Usage

InspectPlot(p, title = NULL)

Arguments

p

A ggplot2 object.

title

Character or NULL. Optional figure panel title to include in the legend text (e.g., "Figure 2A").

Value

A character string - a draft legend sentence.

Details

For plots created by scSidekick functions, a pre-formatted legend is stored as attr(plot, "legend_text") and is returned directly when present.