list_plot_templates
Browse available preset configurations for common visualization patterns like time series, scatter plots with trends, and distribution comparisons to accelerate plot creation.
Instructions
List all available plot templates with descriptions. Templates provide preset configurations for common visualization patterns like time series, scatter with trend, distribution comparison, etc.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/plotnine_mcp/server.py:933-950 (handler)The main handler function for the 'list_plot_templates' tool. It calls get_template_list() to retrieve templates and formats them into a markdown-style message returned as TextContent.async def list_plot_templates_handler() -> list[TextContent]: """Handle list_plot_templates tool calls.""" templates = get_template_list() message = "Available Plot Templates\n" + "=" * 60 + "\n\n" for name, description in sorted(templates.items()): message += f"• {name}\n {description}\n\n" message += "\n" + "=" * 60 + "\n" message += "Usage:\n" message += "Use 'create_plot_from_template' with the template name,\n" message += "data source, and required aesthetics.\n\n" message += "Use 'suggest_plot_templates' to get recommendations\n" message += "based on your data characteristics." return [TextContent(type="text", text=message)]
- src/plotnine_mcp/server.py:398-405 (registration)Tool registration in the list_tools() handler, including name, description, and empty input schema (no parameters required).Tool( name="list_plot_templates", description="List all available plot templates with descriptions. Templates provide preset configurations for common visualization patterns like time series, scatter with trend, distribution comparison, etc.", inputSchema={ "type": "object", "properties": {}, }, ),
- Helper function imported as get_template_list() that extracts and returns the dictionary of all template names and their descriptions from the TEMPLATES data structure.def list_templates() -> dict[str, str]: """ List all available templates with descriptions. Returns: Dictionary mapping template names to descriptions """ return {name: info["description"] for name, info in TEMPLATES.items()}
- src/plotnine_mcp/templates.py:8-130 (helper)Central data structure defining all available plot templates, including names, descriptions, configurations, and required aesthetics. This is the source data used by list_templates().TEMPLATES = { "time_series": { "description": "Line plot optimized for time-based data with date formatting", "config": { "geoms": [{"type": "line", "params": {"size": 1}}], "scales": [{"aesthetic": "x", "type": "datetime", "params": {}}], "theme": { "base": "minimal", "customizations": {"figure_size": [12, 6]}, }, }, "required_aesthetics": ["x", "y"], "suggested_aesthetics": ["color", "group"], }, "scatter_with_trend": { "description": "Scatter plot with linear regression trend line and confidence interval", "config": { "geoms": [ {"type": "point", "params": {"size": 2, "alpha": 0.6}}, {"type": "smooth", "params": {"method": "lm", "se": True}}, ], "theme": {"base": "minimal"}, }, "required_aesthetics": ["x", "y"], "suggested_aesthetics": ["color"], }, "distribution_comparison": { "description": "Violin plot for comparing distributions across groups", "config": { "geoms": [ {"type": "violin", "params": {"alpha": 0.7}}, {"type": "jitter", "params": {"width": 0.1, "alpha": 0.3, "size": 1}}, ], "theme": {"base": "bw"}, }, "required_aesthetics": ["x", "y"], "suggested_aesthetics": ["fill", "color"], }, "category_breakdown": { "description": "Bar chart showing counts or values by category", "config": { "geoms": [{"type": "col", "params": {}}], "theme": { "base": "minimal", "customizations": {"legend_position": "bottom"}, }, "coords": {"type": "flip", "params": {}}, }, "required_aesthetics": ["x", "y"], "suggested_aesthetics": ["fill"], }, "correlation_heatmap": { "description": "Heatmap for visualizing correlations or relationships", "config": { "geoms": [{"type": "tile", "params": {}}], "scales": [ { "aesthetic": "fill", "type": "gradient", "params": {"low": "blue", "high": "red"}, } ], "theme": { "base": "minimal", "customizations": {"figure_size": [10, 8]}, }, }, "required_aesthetics": ["x", "y", "fill"], "suggested_aesthetics": [], }, "boxplot_comparison": { "description": "Boxplot with individual points for detailed distribution comparison", "config": { "geoms": [ {"type": "boxplot", "params": {"alpha": 0.7}}, {"type": "jitter", "params": {"width": 0.2, "alpha": 0.4, "size": 1}}, ], "theme": {"base": "bw"}, }, "required_aesthetics": ["x", "y"], "suggested_aesthetics": ["fill", "color"], }, "multi_line": { "description": "Multiple line plots for comparing trends across categories", "config": { "geoms": [{"type": "line", "params": {"size": 1.2}}], "theme": { "base": "minimal", "customizations": { "figure_size": [12, 6], "legend_position": "right", }, }, }, "required_aesthetics": ["x", "y", "color"], "suggested_aesthetics": ["linetype"], }, "histogram_with_density": { "description": "Histogram overlaid with kernel density curve", "config": { "geoms": [ {"type": "histogram", "params": {"alpha": 0.7, "bins": 30}}, {"type": "density", "params": {"alpha": 0}}, ], "theme": {"base": "minimal"}, }, "required_aesthetics": ["x"], "suggested_aesthetics": ["fill", "color"], }, "before_after": { "description": "Side-by-side comparison of before and after measurements", "config": { "geoms": [ {"type": "point", "params": {"size": 3}}, {"type": "line", "params": {"alpha": 0.5}}, ], "theme": {"base": "bw"}, "facets": {"type": "wrap", "params": {"ncol": 2}}, }, "required_aesthetics": ["x", "y"], "suggested_aesthetics": ["group", "color"], }, }