Matplotlib Best Practices

🌐Community
by mindrally · vlatest · Repository

Generates matplotlib visualizations adhering to style guidelines, ensuring clarity, aesthetics, and accessibility.

Install on your platform

We auto-selected Claude Code based on this skill’s supported platforms.

1

Run in terminal (recommended)

terminal
claude mcp add matplotlib-best-practices npx -- -y @trustedskills/matplotlib-best-practices
2

Or manually add to ~/.claude/settings.json

~/.claude/settings.json
{
  "mcpServers": {
    "matplotlib-best-practices": {
      "command": "npx",
      "args": [
        "-y",
        "@trustedskills/matplotlib-best-practices"
      ]
    }
  }
}

Requires Claude Code (claude CLI). Run claude --version to verify your install.

About This Skill

What it does

This skill provides expert guidance on creating high-quality Matplotlib visualizations in Python. It focuses on data visualization best practices, including code style, plot selection, labeling, color choices, and figure layout, ensuring plots are clear, aesthetically pleasing, accessible (especially for those with colorblindness), and suitable for publication or presentation. The skill emphasizes using the object-oriented API for complex figures while also covering the pyplot interface for quick exploration.

When to use it

  • When creating visualizations for scientific papers or presentations requiring a professional look.
  • For generating plots in Jupyter notebooks where rapid prototyping and interactive exploration are needed.
  • To ensure your Matplotlib visualizations adhere to accessibility guidelines, particularly regarding colorblindness.
  • When needing guidance on selecting the appropriate plot type (line, scatter, bar, histogram, boxplot, heatmap) for a given dataset.
  • For creating complex figures with multiple subplots and customized layouts.

Key capabilities

  • Code Style Guidance: Follows PEP 8 style guidelines for Python code.
  • Plot Type Selection: Provides recommendations for various plot types based on data characteristics.
  • Labeling & Annotation: Emphasizes clear axis labels, descriptive titles, legends, and annotations.
  • Color Accessibility: Recommends colorblind-friendly palettes and avoids problematic color combinations.
  • Object-Oriented API Usage: Guides users in using fig, ax = plt.subplots() for explicit control over figure elements.
  • Style Sheet Customization: Allows the use of built-in styles (e.g., seaborn, ggplot) or creation of custom style files.

Example prompts

  • "Generate a line plot showing sales trends over time with clear axis labels and a descriptive title."
  • "Create a scatter plot to visualize the relationship between two variables, ensuring colorblind accessibility."
  • "Show me how to create a figure with subplots using the object-oriented API in Matplotlib."

Tips & gotchas

  • For complex figures or production code, prioritize the object-oriented API (fig, ax = plt.subplots()) for greater control and maintainability.
  • Always consider accessibility when choosing colors; use colorblind-friendly palettes like 'viridis' or 'plasma'.
  • When using Jupyter notebooks, remember to include %matplotlib inline to display plots directly in the notebook output.

Tags

🛡️

TrustedSkills Verification

Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.

Security Audits

Gen Agent Trust HubPass
SocketPass
SnykPass

Details

Version
vlatest
License
Author
mindrally
Installs
76

🌐 Community

Passed automated security scans.