Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
beita6969 avatar

Matplotlib Viz

  • 16 installs
  • 869 repo stars
  • Updated June 8, 2026
  • beita6969/scienceclaw

matplotlib-viz is a Claude skill for scientific visualization and publication-quality figures using Matplotlib and NumPy.

About

This skill creates scientific and publication-quality figures using Matplotlib and NumPy. It covers common plot types, multi-panel layouts, and journal-specific sizing presets and color palettes. Developers use it for static plots and paper figures, not interactive dashboards or web charts.

  • Scientific visualization and publication-quality figures with Matplotlib and NumPy
  • Line, scatter, bar, histogram, heatmap, subplot, error-bar, box, and violin plots
  • Journal sizing presets and NPG/Lancet/JCO/NEJM color palettes

Matplotlib Viz by the numbers

  • 16 all-time installs (skills.sh)
  • Ranked #1,318 of 2,065 Data Science & ML skills by installs in the Skillselion catalog
  • Data as of Aug 2, 2026 (Skillselion catalog sync)
At a glance

matplotlib-viz capabilities & compatibility

Free; installs matplotlib and numpy via uv.

Capabilities
matplotlib · math computation · meta analysis
Use cases
data analysis · research
Pricing
Free
From the docs

What matplotlib-viz says it does

Scientific visualization and publication-quality figures using Matplotlib and NumPy.
SKILL.md
Always use `matplotlib.use('Agg')` before importing `pyplot` for headless environments.
SKILL.md
Interactive dashboards (use Plotly or Dash)
SKILL.md
npx skills add https://github.com/beita6969/scienceclaw --skill matplotlib-viz

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs16
repo stars869
Last updatedJune 8, 2026
Repositorybeita6969/scienceclaw

What it does

Produce static scientific plots and journal-ready figures with Matplotlib, saved to PNG, SVG, or PDF.

Who is it for?

Static plots, publication-ready scientific figures, and multi-panel layouts.

Skip if: Interactive dashboards, web-based charts, real-time streaming, or map plots.

When should I use this skill?

A user asks for plots, charts, or data visualization for a paper or presentation.

What you get

Saves journal-quality figures to PNG, SVG, or PDF with correct sizing and palettes.

  • PNG, SVG, or PDF scientific figures

By the numbers

  • 4 journal sizing presets
  • 4 journal color palettes (NPG, Lancet, JCO, NEJM)
  • 8 best-practice rules

Files

SKILL.mdMarkdownGitHub ↗

Matplotlib Visualization

Scientific visualization and publication-quality figures using Matplotlib and NumPy.

When to Use

  • Static plots: line, scatter, bar, histogram, heatmap
  • Publication-ready scientific figures
  • Multi-panel (subplot) layouts
  • Saving figures to PNG, SVG, or PDF
  • Annotated or styled plots for presentations and papers

When NOT to Use

  • Interactive dashboards (use Plotly or Dash)
  • Web-based charts (use D3.js or Chart.js)
  • Real-time streaming visualizations
  • Geographic/map plots (use Cartopy or Folium)

Basic Setup

import matplotlib
matplotlib.use('Agg')  # non-interactive backend for saving files
import matplotlib.pyplot as plt
import numpy as np

Line and Scatter Plots

x = np.linspace(0, 10, 100)
fig, ax = plt.subplots(figsize=(8, 5))
ax.plot(x, np.sin(x), label='sin(x)', linewidth=2)
ax.plot(x, np.cos(x), label='cos(x)', linestyle='--')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_title('Trigonometric Functions')
ax.legend()
fig.savefig('line_plot.png', dpi=150, bbox_inches='tight')
plt.close(fig)

# Scatter with colormap
fig, ax = plt.subplots()
sc = ax.scatter(x_data, y_data, c=color_values, cmap='viridis', s=50, alpha=0.7)
fig.colorbar(sc, ax=ax, label='Magnitude')
fig.savefig('scatter.png', dpi=150, bbox_inches='tight')
plt.close(fig)

Bar Charts and Histograms

categories = ['A', 'B', 'C', 'D']
values = [23, 45, 12, 67]
fig, ax = plt.subplots()
ax.bar(categories, values, color='steelblue', edgecolor='black')
ax.set_ylabel('Count')
fig.savefig('bar_chart.png', dpi=150, bbox_inches='tight')
plt.close(fig)

# Histogram with KDE overlay
fig, ax = plt.subplots()
ax.hist(data, bins=30, density=True, alpha=0.7, color='skyblue', edgecolor='black')
ax.set_xlabel('Value')
ax.set_ylabel('Density')
fig.savefig('histogram.png', dpi=150, bbox_inches='tight')
plt.close(fig)

Heatmaps

data_matrix = np.random.rand(10, 10)
fig, ax = plt.subplots(figsize=(8, 6))
im = ax.imshow(data_matrix, cmap='coolwarm', aspect='auto')
fig.colorbar(im, ax=ax)
ax.set_xticks(range(10))
ax.set_yticks(range(10))
fig.savefig('heatmap.png', dpi=150, bbox_inches='tight')
plt.close(fig)

Subplots and Multi-Panel Figures

fig, axes = plt.subplots(2, 2, figsize=(10, 8))
axes[0, 0].plot(x, y1)
axes[0, 0].set_title('Panel A')
axes[0, 1].scatter(x, y2, s=10)
axes[0, 1].set_title('Panel B')
axes[1, 0].bar(categories, values)
axes[1, 0].set_title('Panel C')
axes[1, 1].hist(data, bins=20)
axes[1, 1].set_title('Panel D')
fig.tight_layout()
fig.savefig('multi_panel.png', dpi=150, bbox_inches='tight')
plt.close(fig)

Scientific Figure Templates

# Error bars
fig, ax = plt.subplots()
ax.errorbar(x, y_mean, yerr=y_std, fmt='o-', capsize=4, capthick=1.5, label='Experiment')
ax.fill_between(x, y_mean - y_std, y_mean + y_std, alpha=0.2)
fig.savefig('errorbar.png', dpi=300, bbox_inches='tight')
plt.close(fig)

# Box plot
fig, ax = plt.subplots()
bp = ax.boxplot([group1, group2, group3], labels=['Ctrl', 'Treatment A', 'Treatment B'],
                patch_artist=True, showmeans=True)
fig.savefig('boxplot.png', dpi=300, bbox_inches='tight')
plt.close(fig)

# Violin plot
fig, ax = plt.subplots()
vp = ax.violinplot([group1, group2, group3], showmeans=True, showmedians=True)
ax.set_xticks([1, 2, 3])
ax.set_xticklabels(['Ctrl', 'Treatment A', 'Treatment B'])
fig.savefig('violin.png', dpi=300, bbox_inches='tight')
plt.close(fig)

Saving Figures

fig.savefig('figure.png', dpi=300, bbox_inches='tight')   # raster
fig.savefig('figure.svg', bbox_inches='tight')              # vector (editable)
fig.savefig('figure.pdf', bbox_inches='tight')              # vector (print-ready)

Journal-Quality Figure Standards

Sizing presets (width x height):

  • single_column: (8.5/2.54, 7/2.54) — 8.5 x 7 cm
  • one_half_column: (12/2.54, 9/2.54) — 12 x 9 cm
  • double_column: (17.5/2.54, 10/2.54) — 17.5 x 10 cm
  • presentation: (25/2.54, 18/2.54) — 25 x 18 cm

Journal color palettes:

PALETTES = {
    'NPG': ["#E64B35", "#4DBBD5", "#00A087", "#3C5488", "#F39B7F", "#8491B4", "#91D1C2", "#DC0000", "#7E6148", "#B09C85"],
    'Lancet': ["#00468B", "#ED0000", "#42B540", "#0099B4", "#925E9F", "#FDAF91", "#AD002A", "#ADB6B6"],
    'JCO': ["#0073C2", "#EFC000", "#868686", "#CD534C", "#7AA6DC", "#003C67", "#8F7700", "#3B3B3B"],
    'NEJM': ["#BC3C29", "#0072B5", "#E18727", "#20854E", "#7876B1", "#6F99AD", "#FFDC91", "#EE4C97"],
}

File naming: Use descriptive names a human can understand months later:

  • km_survival_thbs2_high_vs_low.png (not figure1.png)
  • volcano_plot_deseq2_tumor_vs_normal.png (not plot.png)
  • forest_plot_meta_analysis.pdf (not result.pdf)

Best Practices

1. Always use matplotlib.use('Agg') before importing pyplot for headless environments. 2. Use fig, ax = plt.subplots() (OO interface) instead of plt.plot() (state machine). 3. Call plt.close(fig) after saving to free memory. 4. Use bbox_inches='tight' to avoid clipped labels. 5. Set dpi=300 for publication figures, dpi=150 for screen. 6. Use colormaps from matplotlib.colormaps (avoid jet; prefer viridis, coolwarm). 7. Never save to `/tmp/`. Save to the project workspace directory for persistence. 8. Always report the full output path after saving so the user can find the file.

Related skills

FAQ

Does it support journal styling?

Yes, it includes sizing presets and NPG, Lancet, JCO, and NEJM color palettes.

What backend does it use?

It sets matplotlib.use('Agg') for headless environments before importing pyplot.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.