Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Guide to Plotly.py for interactive scientific visualizations in Python
.claude/skills/brycewang-stanford-plotly-interactive-guide/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-08 | ✗→✓ | ▲ Improved | 147% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 146% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 49% | 0% |
| case-15 | ✓→✓ | = Same ✓ | 316% | 0% |
| case-02 | ✓→✓ | = Same ✓ | 127% | 0% |
Plotly.py is a high-level, interactive graphing library for Python with over 18K stars on GitHub. Built on top of plotly.js (which itself uses D3.js and WebGL), Plotly enables researchers to create publication-quality interactive figures directly from Python code. The library integrates seamlessly with pandas DataFrames, NumPy arrays, and the broader scientific Python ecosystem.
What sets Plotly apart for academic researchers is its Plotly Express module, which provides a concise, high-level API for creating complex visualizations in a single function call. Researchers can go from a pandas DataFrame to a fully interactive figure in one line of code, then customize it further as needed. Every Plotly figure is inherently interactive, supporting hover tooltips, zoom, pan, and selection out of the box.
Plotly also offers Dash, a framework for building analytical web applications entirely in Python. This allows researchers to create interactive dashboards for exploring experimental data, sharing results with collaborators, or building supplementary interactive materials for publications without needing front-end development skills.
Plotly Express provides the fastest path from data to visualization. It works directly with pandas DataFrames and supports faceting, color mapping, animation, and trendlines.
pythonimport plotly.express as px import pandas as pd import numpy as np # Simulated experimental data np.random.seed(42) df = pd.DataFrame({ 'concentration': np.random.uniform(0.1, 10, 200), 'response': np.random.normal(0, 1, 200), 'treatment': np.random.choice(['Drug A', 'Drug B', 'Control'], 200), 'cell_line': np.random.choice(['HeLa', 'MCF7', 'A549'], 200) }) df['response'] = df['concentration'] * 0.8 + df['response'] fig = px.scatter( df, x='concentration', y='response', color='treatment', facet_col='cell_line', trendline='ols', title='Dose-Response Across Cell Lines', labels={'concentration': 'Concentration (uM)', 'response': 'Normalized Response'}, template='plotly_white' ) fig.update_layout(font=dict(family='Arial', size=12)) fig.show()
pythonfig = px.box( df, x='treatment', y='response', color='treatment', points='all', title='Treatment Response Distribution', template='plotly_white' ) fig.update_traces(quartilemethod='linear') fig.update_layout(showlegend=False) fig.show()
pythonfig = px.violin( df, x='treatment', y='response', color='treatment', box=True, points='outliers', title='Response Distribution by Treatment Group', template='plotly_white' ) fig.show()
For more customized figures, Plotly's graph_objects module provides full control over every visual element.
pythonimport plotly.graph_objects as go groups = ['Control', 'Low Dose', 'Medium Dose', 'High Dose'] means = [1.0, 1.8, 3.2, 4.5] sems = [0.15, 0.22, 0.31, 0.28] fig = go.Figure() fig.add_trace(go.Bar( x=groups, y=means, error_y=dict(type='data', array=sems, visible=True), marker_color=['#6B7280', '#3B82F6', '#3B82F6', '#3B82F6'], text=[f'{m:.2f}' for m in means], textposition='outside' )) fig.update_layout( title='Treatment Effect on Biomarker Levels', yaxis_title='Relative Expression', xaxis_title='Treatment Group', template='plotly_white', font=dict(family='Arial', size=13), bargap=0.3, yaxis=dict(range=[0, max(means) * 1.3]) ) # Add significance brackets fig.add_annotation( x=0.5, y=max(means) * 1.15, text='*** p < 0.001', showarrow=False, font=dict(size=12) ) fig.show()
pythonimport plotly.figure_factory as ff # Compute correlation matrix corr_matrix = df[['concentration', 'response']].corr() variables = corr_matrix.columns.tolist() fig = ff.create_annotated_heatmap( z=corr_matrix.values, x=variables, y=variables, colorscale='RdBu_r', zmin=-1, zmax=1, showscale=True ) fig.update_layout( title='Variable Correlation Matrix', template='plotly_white', width=600, height=500 ) fig.show()
pythonimport plotly.graph_objects as go import numpy as np x = np.linspace(-3, 3, 50) y = np.linspace(-3, 3, 50) X, Y = np.meshgrid(x, y) Z = np.sin(np.sqrt(X**2 + Y**2)) * np.exp(-0.1 * (X**2 + Y**2)) fig = go.Figure(data=[go.Surface( x=X, y=Y, z=Z, colorscale='Viridis', contours=dict( z=dict(show=True, usecolormap=True, project_z=True) ) )]) fig.update_layout( title='Response Surface Analysis', scene=dict( xaxis_title='Factor A', yaxis_title='Factor B', zaxis_title='Response' ), width=700, height=600 ) fig.show()
python# Create animated scatter showing progression over experimental phases fig = px.scatter( temporal_df, x='metric_a', y='metric_b', animation_frame='time_point', animation_group='sample_id', size='magnitude', color='cluster', hover_name='sample_id', title='Sample Trajectories Over Time', template='plotly_white', range_x=[0, 10], range_y=[0, 10] ) fig.layout.updatemenus[0].buttons[0].args[1]['frame']['duration'] = 800 fig.show()
Plotly provides multiple export options for journal-ready figures.
python# Static export (requires kaleido) fig.write_image('figure_1.pdf', width=800, height=500, scale=3) fig.write_image('figure_1.svg', width=800, height=500) fig.write_image('figure_1.png', width=800, height=500, scale=3) # Interactive HTML for supplementary materials fig.write_html('interactive_figure.html', include_plotlyjs='cdn') # Save as JSON for reproducibility fig.write_json('figure_data.json')
pythonfrom dash import Dash, dcc, html, Input, Output import plotly.express as px app = Dash(__name__) app.layout = html.Div([ html.H1('Experiment Data Explorer'), dcc.Dropdown( id='variable-select', options=[{'label': v, 'value': v} for v in variables], value=variables[0] ), dcc.Graph(id='main-plot') ]) @app.callback(Output('main-plot', 'figure'), Input('variable-select', 'value')) def update_plot(selected_var): return px.histogram(df, x=selected_var, nbins=30, template='plotly_white') if __name__ == '__main__': app.run(debug=True, port=8050)
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→pass | 19,719 | 17,697 | -10% | 1 | 1 | 0% | 3,774 | 5,640 | +49% | 0 | 0 | — |
case-15 | pass→pass | 4,291 | 6,681 | +56% | 1 | 1 | 0% | 804 | 3,343 | +316% | 0 | 0 | — |
case-02 | pass→pass | 10,196 | 9,776 | -4% | 1 | 1 | 0% | 1,711 | 3,877 | +127% | 0 | 0 | — |
case-03 | pass→pass | 8,877 | 8,511 | -4% | 1 | 1 | 0% | 1,453 | 3,333 | +129% | 0 | 0 | — |
case-04 | pass→pass | 7,650 | 4,063 | -47% | 1 | 1 | 0% | 1,223 | 2,912 | +138% | 0 | 0 | — |
case-05 | pass→pass | 8,586 | 5,223 | -39% | 1 | 1 | 0% | 1,520 | 3,048 | +101% | 0 | 0 | — |
case-06 | pass→pass | 8,841 | 5,523 | -38% | 1 | 1 | 0% | 1,524 | 3,255 | +114% | 0 | 0 | — |
case-07 | fail→fail | 8,172 | 9,255 | +13% | 1 | 1 | 0% | 1,634 | 3,927 | +140% | 0 | 0 | — |
case-08 | fail→pass | 9,056 | 9,748 | +8% | 1 | 1 | 0% | 1,489 | 3,673 | +147% | 0 | 0 | — |
case-09 | pass→pass | 5,007 | 4,350 | -13% | 1 | 1 | 0% | 821 | 2,846 | +247% | 0 | 0 | — |
case-10 | fail→pass | 10,090 | 11,991 | +19% | 1 | 1 | 0% | 1,700 | 4,177 | +146% | 0 | 0 | — |
case-11 | pass→pass | 3,183 | 3,718 | +17% | 1 | 1 | 0% | 378 | 2,818 | +646% | 0 | 0 | — |
case-12 | pass→pass | 9,361 | 5,453 | -42% | 1 | 1 | 0% | 1,599 | 3,106 | +94% | 0 | 0 | — |
case-13 | pass→pass | 7,298 | 4,921 | -33% | 1 | 1 | 0% | 1,197 | 2,902 | +142% | 0 | 0 | — |
case-14 | pass→pass | 8,793 | 11,829 | +35% | 1 | 1 | 0% | 1,612 | 4,151 | +158% | 0 | 0 | — |
case-16 | pass→pass | 3,385 | 4,351 | +29% | 1 | 1 | 0% | 591 | 2,816 | +376% | 0 | 0 | — |
case-17 | pass→pass | 4,926 | 5,958 | +21% | 1 | 1 | 0% | 883 | 3,133 | +255% | 0 | 0 | — |
case-18 | pass→pass | 5,160 | 5,362 | +4% | 1 | 1 | 0% | 870 | 3,076 | +254% | 0 | 0 | — |
case-19 | pass→pass | 4,193 | 3,232 | -23% | 1 | 1 | 0% | 511 | 2,716 | +432% | 0 | 0 | — |
case-20 | pass→pass | 10,250 | 12,234 | +19% | 1 | 1 | 0% | 1,895 | 4,340 | +129% | 0 | 0 | — |
case-21 | pass→pass | 5,078 | 5,754 | +13% | 1 | 1 | 0% | 854 | 3,094 | +262% | 0 | 0 | — |
case-22 | pass→pass | 6,410 | 3,554 | -45% | 1 | 1 | 0% | 1,220 | 2,751 | +125% | 0 | 0 | — |
case-23 | pass→pass | 8,076 | 7,595 | -6% | 1 | 1 | 0% | 1,384 | 3,551 | +157% | 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. 23 cases were attempted. The headline lift of +9 percentage points is the difference between those two pass rates over the 23 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.