matplotlib
Low-level plotting library for full customization. Use when you need fine-grained control over every plot element, creating novel plot types, or integrating with specific scientific workflows. Export to PNG/PDF/SVG for publication. For quick statistical plots use seaborn; for interactive plots use plotly; for publication-ready multi-panel figures with journal styling, use scientific-visualization.
Author
Category
Image ProcessingInstall
Download and extract to your skills directory
Copy command and send to OpenClaw for auto-install:
Matplotlib - Python Data Visualization and Plotting Skills
Skill Overview
Matplotlib is a fundamental Python visualization library for creating static, animated, and interactive charts. Use this skill when you need fine-grained control over every chart element, create novel chart types, or integrate visualizations into specific scientific workflows.
Applicable Scenarios
1. Research Papers and Academic Publishing
Create publication-quality multi-panel figures that meet journal requirements. Supports exporting to vector formats like PNG, PDF, SVG, precise control of DPI, colormaps, and font styles to satisfy the strict quality requirements of academic publishing.
2. Scientific Data Exploration and Analysis
Visualize data in conjunction with NumPy/Pandas. Supports line plots, scatter plots, bar charts, histograms, heatmaps, contour plots, box plots, etc., suitable for time series analysis, distribution analysis, correlation analysis, and other scientific computing scenarios.
3. Custom Visualization Development
Use when you need to go beyond preset chart types and create unique visual effects. Provides an object-oriented API (Figure/Axes) for full control over every chart element, including layout, style, annotations, and animation, and can be integrated into Jupyter Notebook or GUI applications.
Core Features
1. Diverse Chart Types
Supports 10+ common chart types: line plots (time series, trends), scatter plots (variable relationships), bar charts (categorical comparison), histograms (data distribution), heatmaps (matrix data), contour plots (3D data projection), box plots, violin plots, 3D surface plots, and more.
2. Fine-grained Style Control
Provides multiple style sheets (seaborn, ggplot, etc.), supports global configuration via rcParams, custom colormaps, font settings, legend placement, grid styles, and more. Can create color-accessible charts suitable for academic publication and presentations.
3. Flexible Layouts and Export
Supports regular grids, mosaic layouts, GridSpec, and other subplot arrangements. Automatically handles element overlap (constrained_layout). Can export high-resolution bitmaps (300+ DPI) or vector formats (PDF/SVG) to ensure clarity across media.
Frequently Asked Questions
What's the difference between matplotlib and seaborn?
Matplotlib is a low-level plotting library that provides full control over each element; seaborn is a high-level statistical plotting library built on matplotlib. Choose seaborn for quickly creating statistical plots with attractive default styles; choose matplotlib when you need custom charts, fine control over every element, or integration into specific workflows. They can be used together.
How do I create publication-quality multi-panel figures?
Use the object-oriented interface fig, axes = plt.subplots() to create figures. It is recommended to use constrained_layout=True to automatically handle spacing, or use GridSpec for complex layouts. When exporting, set dpi=300 (for papers) and bbox_inches='tight' to remove excess whitespace. Choose PDF/SVG vector formats or high-resolution PNG according to journal requirements.
What's the difference between the pyplot interface and the object-oriented interface?
pyplot is a MATLAB-style implicit interface suitable for quick interactive plotting; the object-oriented interface (fig, ax) explicitly manages Figure and Axes objects and is recommended for production code. The object-oriented approach is better for multi-subplot layouts, complex chart customization, and code maintenance, and avoids confusion that the pyplot state machine can cause.