Skip to main content
Glama
by Fervoyush

create_plot

Generate customizable statistical visualizations using plotnine's grammar of graphics. Create scatter plots, line charts, histograms, and multi-layer plots with themes, facets, and scales from various data sources.

Instructions

Create a plotnine visualization from data.

This tool allows you to create highly customizable plots using the grammar of graphics. You can specify data sources (file, URL, or inline), aesthetic mappings, geometries, scales, themes, facets, labels, and coordinate systems.

NEW: Multi-layer plots! Use 'geoms' array to combine multiple geometries in one plot.

Example usage:

  • Simple scatter plot: provide data_source, aes (x, y), and geom (type: "point")

  • Multi-layer plot: use geoms array with multiple geometries (e.g., point + smooth)

  • Line plot with custom theme: add theme config with base and customizations

  • Faceted plot: include facet config to split by categorical variables

  • Multiple scales: provide list of scale configs for x, y, color, etc.

All parameters support extensive customization through nested objects.

Input Schema

NameRequiredDescriptionDefault
data_sourceYesData source configuration (file, URL, or inline data)
aesYesAesthetic mappings (column names from data)
geomNoSingle geometry specification (use 'geoms' for multi-layer plots)
geomsNoMultiple geometry specifications for layered plots (e.g., scatter + smooth, boxplot + jitter)
scalesNoScale configurations for axes and aesthetics
themeNoTheme configuration
facetsNoFaceting configuration
labelsNoPlot labels
coordsNoCoordinate system configuration
statsNoStatistical transformation configurations
outputNoOutput configuration

Input Schema (JSON Schema)

{ "properties": { "aes": { "description": "Aesthetic mappings (column names from data)", "properties": { "alpha": { "description": "Alpha (transparency) variable", "type": "string" }, "color": { "description": "Color variable", "type": "string" }, "fill": { "description": "Fill variable", "type": "string" }, "group": { "description": "Grouping variable", "type": "string" }, "linetype": { "description": "Linetype variable", "type": "string" }, "shape": { "description": "Shape variable", "type": "string" }, "size": { "description": "Size variable", "type": "string" }, "x": { "description": "X-axis variable", "type": "string" }, "y": { "description": "Y-axis variable", "type": "string" } }, "type": "object" }, "coords": { "description": "Coordinate system configuration", "properties": { "params": { "description": "Coordinate parameters", "type": "object" }, "type": { "description": "Coordinate type: cartesian, flip, fixed, trans", "type": "string" } }, "type": "object" }, "data_source": { "description": "Data source configuration (file, URL, or inline data)", "properties": { "data": { "description": "Inline data as array of objects (for inline type)", "items": { "type": "object" }, "type": "array" }, "format": { "description": "Data format (auto-detected if not specified)", "enum": [ "csv", "json", "parquet", "excel" ], "type": "string" }, "path": { "description": "File path or URL (for file/url types)", "type": "string" }, "type": { "description": "Source type", "enum": [ "file", "url", "inline" ], "type": "string" } }, "required": [ "type" ], "type": "object" }, "facets": { "description": "Faceting configuration", "properties": { "cols": { "description": "Column variable for facet_grid", "type": "string" }, "facets": { "description": "Faceting formula for facet_wrap (e.g., '~ variable')", "type": "string" }, "params": { "description": "Additional facet parameters (ncol, scales, etc.)", "type": "object" }, "rows": { "description": "Row variable for facet_grid", "type": "string" }, "type": { "description": "Facet type", "enum": [ "wrap", "grid" ], "type": "string" } }, "type": "object" }, "geom": { "description": "Single geometry specification (use 'geoms' for multi-layer plots)", "properties": { "params": { "description": "Additional geom parameters (e.g., size, alpha, color, fill, etc.)", "type": "object" }, "type": { "description": "Geometry type: point, line, bar, histogram, boxplot, violin, area, density, smooth, jitter, tile, text, errorbar, hline, vline, abline, path, polygon, ribbon, col", "type": "string" } }, "required": [ "type" ], "type": "object" }, "geoms": { "description": "Multiple geometry specifications for layered plots (e.g., scatter + smooth, boxplot + jitter)", "items": { "properties": { "params": { "description": "Additional geom parameters (e.g., size, alpha, color, fill, etc.)", "type": "object" }, "type": { "description": "Geometry type: point, line, bar, histogram, boxplot, violin, area, density, smooth, jitter, tile, text, errorbar, hline, vline, abline, path, polygon, ribbon, col", "type": "string" } }, "required": [ "type" ], "type": "object" }, "type": "array" }, "labels": { "description": "Plot labels", "properties": { "caption": { "description": "Plot caption", "type": "string" }, "subtitle": { "description": "Plot subtitle", "type": "string" }, "title": { "description": "Plot title", "type": "string" }, "x": { "description": "X-axis label", "type": "string" }, "y": { "description": "Y-axis label", "type": "string" } }, "type": "object" }, "output": { "description": "Output configuration", "properties": { "directory": { "default": "./output", "description": "Output directory", "type": "string" }, "dpi": { "default": 300, "description": "DPI for raster formats", "type": "integer" }, "filename": { "description": "Output filename (auto-generated if not provided)", "type": "string" }, "format": { "default": "png", "enum": [ "png", "pdf", "svg" ], "type": "string" }, "height": { "default": 6, "description": "Height in inches", "type": "number" }, "width": { "default": 8, "description": "Width in inches", "type": "number" } }, "type": "object" }, "scales": { "description": "Scale configurations for axes and aesthetics", "items": { "properties": { "aesthetic": { "description": "Which aesthetic: x, y, color, fill, size, etc.", "type": "string" }, "params": { "description": "Scale parameters (limits, breaks, labels, etc.)", "type": "object" }, "type": { "description": "Scale type: continuous, discrete, log10, sqrt, datetime, gradient, brewer, etc.", "type": "string" } }, "required": [ "aesthetic", "type" ], "type": "object" }, "type": "array" }, "stats": { "description": "Statistical transformation configurations", "items": { "properties": { "params": { "description": "Stat parameters", "type": "object" }, "type": { "description": "Stat type: smooth, bin, density, summary", "type": "string" } }, "required": [ "type" ], "type": "object" }, "type": "array" }, "theme": { "description": "Theme configuration", "properties": { "base": { "default": "gray", "description": "Base theme: gray, bw, minimal, classic, dark, light, void", "type": "string" }, "customizations": { "description": "Theme customizations (figure_size, legend_position, text properties, etc.)", "type": "object" } }, "type": "object" } }, "required": [ "data_source", "aes" ], "type": "object" }

Other Tools from Plotnine MCP Server

Related Tools

    MCP directory API

    We provide all the information about MCP servers via our MCP API.

    curl -X GET 'https://glama.ai/api/mcp/v1/servers/Fervoyush/plotnine-mcp'

    If you have feedback or need assistance with the MCP directory API, please join our Discord server