Interactive visualization library for Python. Use it when you need hover tooltips, zoom/pan, selection, animations, or charts embeddable in web pages (e.g., dashboards, exploratory analysis, presentations).
60
70%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./scientific-skills/Other/plotly/SKILL.mdreferences/ for task-specific guidance.Python: 3.10+. Repository baseline for current packaged skills.Third-party packages: not explicitly version-pinned in this skill package. Add pinned versions if this skill needs stricter environment control.Skill directory: 20260316/scientific-skills/Others/plotly
No packaged executable script was detected.
Use the documented workflow in SKILL.md together with the references/assets in this folder.Example run plan:
SKILL.md.references/ contains supporting rules, prompts, or checklists.Use Plotly when you need interactive, shareable visualizations, especially in these scenarios:
If you only need static publication figures, consider Matplotlib or other scientific visualization tools.
plotly.express, px): high-level, concise API for common charts from DataFrames.plotly.graph_objects, go): low-level building blocks for full control and custom figures.Figure, so you can mix both styles.make_subplots)plotly_dark, plotly_white)write_html)write_image)Reference guides (optional reading):
reference/plotly-express.mdreference/graph-objects.mdreference/chart-types.mdreference/layouts-styling.mdreference/export-interactivity.mdplotly>=5.0pandas>=1.5 (recommended for DataFrame-based workflows)kaleido>=0.2 (optional, required for static image export: PNG/SVG/PDF)dash>=2.0 (optional, for building interactive web apps)A complete runnable example demonstrating: Plotly Express + Graph Objects updates, hover customization, subplots, and export.
uv pip install "plotly>=5.0" "pandas>=1.5" "kaleido>=0.2"import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
def main():
# Sample dataset
df = pd.DataFrame(
{
"x": [1, 2, 3, 4, 5],
"y": [10, 11, 12, 11.5, 13],
"group": ["A", "A", "B", "B", "B"],
}
)
# 1) Quick chart with Plotly Express
fig_scatter = px.scatter(
df,
x="x",
y="y",
color="group",
title="Scatter (px) + Graph Objects Updates",
template="plotly_white",
)
# 2) Use Graph Objects methods on a px figure
fig_scatter.update_traces(
hovertemplate="x=%{x}<br>y=%{y:.2f}<br>group=%{marker.color}<extra></extra>"
)
fig_scatter.add_hline(y=11, line_dash="dash", line_color="gray")
# 3) Build a small dashboard-like layout with subplots
fig = make_subplots(
rows=1,
cols=2,
subplot_titles=("Interactive Scatter", "Group Means (Bar)"),
specs=[[{"type": "scatter"}, {"type": "bar"}]],
)
# Left: reuse traces from the px figure
for tr in fig_scatter.data:
fig.add_trace(tr, row=1, col=1)
# Right: bar chart with group means
means = df.groupby("group", as_index=False)["y"].mean()
fig.add_trace(
go.Bar(x=means["group"], y=means["y"], name="mean(y)"),
row=1,
col=2,
)
fig.update_layout(
title="Plotly End-to-End Example",
height=450,
legend_title_text="Group",
margin=dict(l=40, r=20, t=70, b=40),
)
# Show interactively (notebook or supported environment)
fig.show()
# Export
fig.write_html("plotly_example.html", include_plotlyjs="cdn")
fig.write_image("plotly_example.png") # requires kaleido
if __name__ == "__main__":
main()px vs goplotly.express (px) when:
plotly.graph_objects (go) when:
px.* returns a go.Figure, so fig.update_layout(...), fig.add_trace(...), fig.add_hline(...), etc. work seamlessly.hovertemplate to control text and numeric formatting.fig.update_xaxes(rangeslider_visible=True)write_html) preserves full interactivity.
include_plotlyjs="cdn" reduces file size but requires internet access to load Plotly JS.write_image) requires Kaleido and produces PNG/SVG/PDF suitable for reports.plotly_result.md unless the skill documentation defines a better convention.Run this minimal verification path before full execution when possible:
No local script validation step is required for this skill.Expected output format:
Result file: plotly_result.md
Validation summary: PASS/FAIL with brief notes
Assumptions: explicit list if any63c61d3
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.