Central routing function for displaying R plot objects. Validates the plot object class, then routes to the appropriate rendering path based on target audience and MCP App support.
Usage
channel_plot(
plot_obj,
mcp_apps_supported = FALSE,
target = c("user", "agent"),
width = NULL,
height = NULL
)Arguments
- plot_obj
A plot object (ggplot, plotly, htmlwidget, recordedplot, grob, gtable, trellis, or captured_plot)
- mcp_apps_supported
Logical; MCP App structuredContent support
- target
Character; "user" (display) or "agent" (base64 analysis)
- width, height
Optional render size in pixels (100-4000) for the agent image and the MCP App viewer. Recorded plots (
recordedplot) replay at any size. Ignored by the responsive httpgd viewer.
Examples
if (FALSE) { # \dontrun{
captured <- capture_plot(plot(cars))
channel_plot(captured)
} # }
