Learn R Programming

maidr (version 0.1.2)

find_graphics_plot_grob: Utility functions for robust selector generation in Base R plots

Description

These functions provide a robust way to find grob elements and generate CSS selectors, independent of panel structure or hardcoded values. Find grob by element type pattern

Usage

find_graphics_plot_grob(grob, element_type, plot_index = NULL)

Value

The name of the first matching grob, or NULL if not found

Arguments

grob

The grob tree to search (typically from ggplotify::as.grob())

element_type

The element type to search for (e.g., "rect", "lines", "points")

plot_index

Optional plot index to match (for multipanel layouts)

Details

Searches recursively through a grob tree to find a grob whose name matches the pattern: graphics-plot-<number>-<element_type>-<number>