$npx -y skills add LeonChaoX/qinyan-academic-skills --skill scientific-visualizationMeta-skill for publication-ready figures. Use when creating journal submission figures requiring multi-panel layouts, significance annotations, error bars, colorblind-safe palettes, and specific journal formatting (Nature, Science, Cell). Orchestrates matplotlib/seaborn/plotly wi
| 1 | # Scientific Visualization |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Scientific visualization transforms data into clear, accurate figures for publication. Create journal-ready plots with multi-panel layouts, error bars, significance markers, and colorblind-safe palettes. Export as PDF/EPS/TIFF using matplotlib, seaborn, and plotly for manuscripts. |
| 6 | |
| 7 | ## When to Use This Skill |
| 8 | |
| 9 | This skill should be used when: |
| 10 | - Creating plots or visualizations for scientific manuscripts |
| 11 | - Preparing figures for journal submission (Nature, Science, Cell, PLOS, etc.) |
| 12 | - Ensuring figures are colorblind-friendly and accessible |
| 13 | - Making multi-panel figures with consistent styling |
| 14 | - Exporting figures at correct resolution and format |
| 15 | - Following specific publication guidelines |
| 16 | - Improving existing figures to meet publication standards |
| 17 | - Creating figures that need to work in both color and grayscale |
| 18 | |
| 19 | ## Quick Start Guide |
| 20 | |
| 21 | ### Basic Publication-Quality Figure |
| 22 | |
| 23 | ```python |
| 24 | import matplotlib.pyplot as plt |
| 25 | import numpy as np |
| 26 | |
| 27 | # Apply publication style (from scripts/style_presets.py) |
| 28 | from style_presets import apply_publication_style |
| 29 | apply_publication_style('default') |
| 30 | |
| 31 | # Create figure with appropriate size (single column = 3.5 inches) |
| 32 | fig, ax = plt.subplots(figsize=(3.5, 2.5)) |
| 33 | |
| 34 | # Plot data |
| 35 | x = np.linspace(0, 10, 100) |
| 36 | ax.plot(x, np.sin(x), label='sin(x)') |
| 37 | ax.plot(x, np.cos(x), label='cos(x)') |
| 38 | |
| 39 | # Proper labeling with units |
| 40 | ax.set_xlabel('Time (seconds)') |
| 41 | ax.set_ylabel('Amplitude (mV)') |
| 42 | ax.legend(frameon=False) |
| 43 | |
| 44 | # Remove unnecessary spines |
| 45 | ax.spines['top'].set_visible(False) |
| 46 | ax.spines['right'].set_visible(False) |
| 47 | |
| 48 | # Save in publication formats (from scripts/figure_export.py) |
| 49 | from figure_export import save_publication_figure |
| 50 | save_publication_figure(fig, 'figure1', formats=['pdf', 'png'], dpi=300) |
| 51 | ``` |
| 52 | |
| 53 | ### Using Pre-configured Styles |
| 54 | |
| 55 | Apply journal-specific styles using the matplotlib style files in `assets/`: |
| 56 | |
| 57 | ```python |
| 58 | import matplotlib.pyplot as plt |
| 59 | |
| 60 | # Option 1: Use style file directly |
| 61 | plt.style.use('assets/nature.mplstyle') |
| 62 | |
| 63 | # Option 2: Use style_presets.py helper |
| 64 | from style_presets import configure_for_journal |
| 65 | configure_for_journal('nature', figure_width='single') |
| 66 | |
| 67 | # Now create figures - they'll automatically match Nature specifications |
| 68 | fig, ax = plt.subplots() |
| 69 | # ... your plotting code ... |
| 70 | ``` |
| 71 | |
| 72 | ### Quick Start with Seaborn |
| 73 | |
| 74 | For statistical plots, use seaborn with publication styling: |
| 75 | |
| 76 | ```python |
| 77 | import seaborn as sns |
| 78 | import matplotlib.pyplot as plt |
| 79 | from style_presets import apply_publication_style |
| 80 | |
| 81 | # Apply publication style |
| 82 | apply_publication_style('default') |
| 83 | sns.set_theme(style='ticks', context='paper', font_scale=1.1) |
| 84 | sns.set_palette('colorblind') |
| 85 | |
| 86 | # Create statistical comparison figure |
| 87 | fig, ax = plt.subplots(figsize=(3.5, 3)) |
| 88 | sns.boxplot(data=df, x='treatment', y='response', |
| 89 | order=['Control', 'Low', 'High'], palette='Set2', ax=ax) |
| 90 | sns.stripplot(data=df, x='treatment', y='response', |
| 91 | order=['Control', 'Low', 'High'], |
| 92 | color='black', alpha=0.3, size=3, ax=ax) |
| 93 | ax.set_ylabel('Response (μM)') |
| 94 | sns.despine() |
| 95 | |
| 96 | # Save figure |
| 97 | from figure_export import save_publication_figure |
| 98 | save_publication_figure(fig, 'treatment_comparison', formats=['pdf', 'png'], dpi=300) |
| 99 | ``` |
| 100 | |
| 101 | ## Core Principles and Best Practices |
| 102 | |
| 103 | ### 1. Resolution and File Format |
| 104 | |
| 105 | **Critical requirements** (detailed in `references/publication_guidelines.md`): |
| 106 | - **Raster images** (photos, microscopy): 300-600 DPI |
| 107 | - **Line art** (graphs, plots): 600-1200 DPI or vector format |
| 108 | - **Vector formats** (preferred): PDF, EPS, SVG |
| 109 | - **Raster formats**: TIFF, PNG (never JPEG for scientific data) |
| 110 | |
| 111 | **Implementation:** |
| 112 | ```python |
| 113 | # Use the figure_export.py script for correct settings |
| 114 | from figure_export import save_publication_figure |
| 115 | |
| 116 | # Saves in multiple formats with proper DPI |
| 117 | save_publication_figure(fig, 'myfigure', formats=['pdf', 'png'], dpi=300) |
| 118 | |
| 119 | # Or save for specific journal requirements |
| 120 | from figure_export import save_for_journal |
| 121 | save_for_journal(fig, 'figure1', journal='nature', figure_type='combination') |
| 122 | ``` |
| 123 | |
| 124 | ### 2. Color Selection - Colorblind Accessibility |
| 125 | |
| 126 | **Always use colorblind-friendly palettes** (detailed in `references/color_palettes.md`): |
| 127 | |
| 128 | **Recommended: Okabe-Ito palette** (distinguishable by all types of color blindness): |
| 129 | ```python |
| 130 | # Option 1: Use assets/color_palettes.py |
| 131 | from color_palettes import OKABE_ITO_LIST, apply_palette |
| 132 | apply_palette('okabe_ito') |
| 133 | |
| 134 | # Option 2: Manual specification |
| 135 | okabe_ito = ['#E69F00', '#56B4E9', '#009E73', '#F0E442', |
| 136 | '#0072B2', '#D55E00', '#CC79A7', '#000000'] |
| 137 | plt.rcParams['axes.p |