Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Generate publication-quality chart images from research data
.claude/skills/brycewang-stanford-chart-image-generator/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-11 | ✗→✓ | ▲ Improved | 57% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 85% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 95% | 0% |
| case-20 | ✗→✓ | ▲ Improved | 74% | 0% |
| case-22 | ✗→✓ | ▲ Improved | 99% | 0% |
A skill for generating publication-quality chart images from research data using Python visualization libraries. Covers chart type selection, styling for academic journals, multi-panel layouts, color accessibility, and export at the correct resolution and format for submission.
Creating figures for academic publications requires more than just plotting data. Journals have specific requirements for resolution (typically 300-600 DPI), file format (TIFF, EPS, PDF, or high-resolution PNG), font sizes (often 8-12pt in the final printed figure), line weights, and color accessibility. This skill automates the production of figures that meet these standards, reducing the time researchers spend on manual formatting and ensuring consistency across all figures in a manuscript.
The skill supports common chart types used in academic research: scatter plots, bar charts, line plots, box plots, violin plots, heatmaps, forest plots, Kaplan-Meier curves, and multi-panel composite figures. All examples use matplotlib and seaborn with a custom academic styling configuration.
pythonimport matplotlib.pyplot as plt import matplotlib as mpl def set_academic_style(): """ Configure matplotlib for publication-quality figures. Matches common requirements for Nature, Science, PLOS, IEEE journals. """ plt.rcParams.update({ # Font settings 'font.family': 'sans-serif', 'font.sans-serif': ['Arial', 'Helvetica', 'DejaVu Sans'], 'font.size': 8, 'axes.titlesize': 9, 'axes.labelsize': 8, 'xtick.labelsize': 7, 'ytick.labelsize': 7, 'legend.fontsize': 7, # Line and marker settings 'lines.linewidth': 1.0, 'lines.markersize': 4, 'axes.linewidth': 0.5, 'xtick.major.width': 0.5, 'ytick.major.width': 0.5, # Grid and background 'axes.grid': False, 'axes.facecolor': 'white', 'figure.facecolor': 'white', # Legend 'legend.frameon': False, 'legend.borderpad': 0.3, # Save settings 'savefig.dpi': 300, 'savefig.bbox': 'tight', 'savefig.pad_inches': 0.05, # Use Type 1 fonts for EPS/PDF (required by many journals) 'pdf.fonttype': 42, 'ps.fonttype': 42, }) # Common journal figure widths (in inches): SINGLE_COLUMN = 3.5 # ~89mm (Nature, Science, PLOS) DOUBLE_COLUMN = 7.0 # ~178mm ONE_AND_HALF = 5.5 # ~140mm
python# Colorblind-safe palettes for academic figures PALETTES = { 'categorical_8': [ '#332288', '#88CCEE', '#44AA99', '#117733', '#999933', '#DDCC77', '#CC6677', '#882255' ], # Tol's qualitative palette 'sequential': 'viridis', # Perceptually uniform 'diverging': 'RdBu_r', # Red-Blue diverging 'binary': ['#0072B2', '#D55E00'], # Blue and vermilion }
| Data Pattern | Recommended Chart | When to Use | |-------------|------------------|-------------| | Distribution of one variable | Histogram, KDE, violin | Showing data spread | | Comparing groups | Box plot, violin, bar + error bars | Group differences | | Two continuous variables | Scatter plot | Correlation, regression | | Trends over time | Line plot | Time series, longitudinal | | Proportions | Stacked bar, pie (sparingly) | Composition | | Correlation matrix | Heatmap | Many variable pairs | | Effect sizes + CIs | Forest plot | Meta-analysis, multi-model | | Survival data | Kaplan-Meier curve | Time-to-event |
pythonimport numpy as np import seaborn as sns def scatter_with_regression(x, y, xlabel, ylabel, title, output_path, groups=None, group_label=None): """ Create a scatter plot with regression line and confidence interval. """ set_academic_style() fig, ax = plt.subplots(figsize=(SINGLE_COLUMN, SINGLE_COLUMN * 0.8)) if groups is not None: for group_val in sorted(set(groups)): mask = groups == group_val ax.scatter(x[mask], y[mask], s=15, alpha=0.7, label=group_val) ax.legend(title=group_label) else: ax.scatter(x, y, s=15, alpha=0.7, color=PALETTES['binary'][0]) # Add regression line from scipy import stats slope, intercept, r, p, se = stats.linregress(x, y) x_line = np.linspace(x.min(), x.max(), 100) ax.plot(x_line, slope * x_line + intercept, color='#CC6677', linewidth=1.0, linestyle='--') # Annotate with statistics ax.text(0.05, 0.95, f'r = {r:.3f}\np = {p:.3f}', transform=ax.transAxes, verticalalignment='top', fontsize=7) ax.set_xlabel(xlabel) ax.set_ylabel(ylabel) ax.set_title(title) fig.savefig(output_path, dpi=300, bbox_inches='tight') plt.close(fig) return output_path
pythondef create_multipanel_figure(panels: list, ncols: int = 2, output_path: str = 'figure.pdf'): """ Create a multi-panel figure with automatic panel labels (A, B, C, ...). Args: panels: List of dicts with 'plot_func', 'args', 'title' ncols: Number of columns output_path: Output file path """ set_academic_style() nrows = int(np.ceil(len(panels) / ncols)) fig, axes = plt.subplots(nrows, ncols, figsize=(DOUBLE_COLUMN, 3.0 * nrows)) axes = axes.flatten() if hasattr(axes, 'flatten') else [axes] for i, (ax, panel) in enumerate(zip(axes, panels)): panel['plot_func'](ax, **panel.get('args', {})) # Add panel label (A, B, C, ...) ax.text(-0.15, 1.08, chr(65 + i), transform=ax.transAxes, fontsize=11, fontweight='bold', va='top') if 'title' in panel: ax.set_title(panel['title']) # Hide unused panels for ax in axes[len(panels):]: ax.set_visible(False) fig.tight_layout() fig.savefig(output_path, dpi=300, bbox_inches='tight') plt.close(fig) return output_path
| Journal / Publisher | Format | DPI | Max Width | Color Mode | |--------------------|--------|-----|-----------|------------| | Nature | TIFF, EPS, PDF | 300 | 180mm | RGB | | Science | EPS, PDF | 300 | 174mm | RGB | | PLOS | TIFF, EPS | 300 | 174mm | RGB | | IEEE | EPS, PDF, PNG | 300 | 3.5in (1-col) | RGB or CMYK | | Elsevier | TIFF, EPS, PDF | 300-600 | 190mm | RGB or CMYK | | Springer | TIFF, EPS, PDF | 300 | 174mm | RGB or CMYK |
pythondef export_figure(fig, basename: str, formats=('pdf', 'png', 'tiff'), dpi=300): """Export a figure in multiple formats for journal submission.""" paths = [] for fmt in formats: path = f"{basename}.{fmt}" fig.savefig(path, format=fmt, dpi=dpi, bbox_inches='tight', facecolor='white', edgecolor='none') paths.append(path) return paths
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-09 | fail→fail | 14,341 | 12,633 | -12% | 1 | 1 | 0% | 2,371 | 4,598 | +94% | 0 | 0 | — |
case-01 | fail→fail | 19,646 | 21,868 | +11% | 1 | 1 | 0% | 3,890 | 4,365 | +12% | 0 | 0 | — |
case-02 | fail→fail | 16,064 | 17,857 | +11% | 1 | 1 | 0% | 3,173 | 6,047 | +91% | 0 | 0 | — |
case-03 | fail→fail | 34,084 | 29,277 | -14% | 1 | 1 | 0% | 6,920 | 8,361 | +21% | 0 | 0 | — |
case-04 | pass→pass | 10,120 | 10,143 | +0% | 1 | 1 | 0% | 2,065 | 4,444 | +115% | 0 | 0 | — |
case-05 | pass→pass | 8,982 | 9,333 | +4% | 1 | 1 | 0% | 1,841 | 4,285 | +133% | 0 | 0 | — |
case-06 | pass→pass | 21,037 | 24,676 | +17% | 1 | 1 | 0% | 4,360 | 7,575 | +74% | 0 | 0 | — |
case-07 | fail→fail | 20,021 | 19,354 | -3% | 1 | 1 | 0% | 3,715 | 6,115 | +65% | 0 | 0 | — |
case-08 | pass→pass | 15,705 | 6,633 | -58% | 1 | 1 | 0% | 3,116 | 3,673 | +18% | 0 | 0 | — |
case-10 | pass→pass | 11,170 | 10,723 | -4% | 1 | 1 | 0% | 1,959 | 4,319 | +120% | 0 | 0 | — |
case-11 | fail→pass | 14,816 | 9,018 | -39% | 1 | 1 | 0% | 2,565 | 4,027 | +57% | 0 | 0 | — |
case-12 | fail→pass | 14,307 | 13,552 | -5% | 1 | 1 | 0% | 2,525 | 4,683 | +85% | 0 | 0 | — |
case-13 | pass→pass | 15,467 | 10,174 | -34% | 1 | 1 | 0% | 2,655 | 4,150 | +56% | 0 | 0 | — |
case-14 | fail→pass | 14,455 | 12,623 | -13% | 1 | 1 | 0% | 2,271 | 4,426 | +95% | 0 | 0 | — |
case-15 | pass→pass | 6,679 | 5,019 | -25% | 1 | 1 | 0% | 1,157 | 3,130 | +171% | 0 | 0 | — |
case-16 | pass→pass | 11,574 | 22,271 | +92% | 1 | 1 | 0% | 1,879 | 6,480 | +245% | 0 | 0 | — |
case-17 | pass→pass | 10,454 | 20,940 | +100% | 1 | 1 | 0% | 1,725 | 6,498 | +277% | 0 | 0 | — |
case-18 | pass→pass | 12,036 | 13,833 | +15% | 1 | 1 | 0% | 1,864 | 4,743 | +154% | 0 | 0 | — |
case-19 | fail→fail | 12,880 | 13,698 | +6% | 1 | 1 | 0% | 2,273 | 4,846 | +113% | 0 | 0 | — |
case-20 | fail→pass | 15,688 | 13,828 | -12% | 1 | 1 | 0% | 2,773 | 4,820 | +74% | 0 | 0 | — |
case-21 | pass→pass | 13,276 | 10,772 | -19% | 1 | 1 | 0% | 2,126 | 4,134 | +94% | 0 | 0 | — |
case-22 | fail→pass | 12,099 | 9,688 | -20% | 1 | 1 | 0% | 1,996 | 3,980 | +99% | 0 | 0 | — |
case-23 | fail→pass | 13,800 | 10,502 | -24% | 1 | 1 | 0% | 2,402 | 3,990 | +66% | 0 | 0 | — |
case-24 | fail→pass | 10,690 | 7,495 | -30% | 1 | 1 | 0% | 1,709 | 3,611 | +111% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +29 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.