Chuyển đến nội dung
Skillpedia
Phân tích và bảng tính48k · #5458

plotly

Skill này làm gì

Plotly là công cụ tạo biểu đồ tương tác và đẹp mắt. Bạn có thể khám phá dữ liệu, tạo bài thuyết trình và cả bảng điều khiển với nó.

Khi nào nên dùng

  • ✓Khi bạn muốn xem chi tiết dữ liệu bằng cách rê chuột lên biểu đồ.
  • ✓Khi xây dựng bảng điều khiển có nhiều biểu đồ.
  • ✓Khi trình bày cần biểu đồ có tính tương tác.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/plotly/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/plotly/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo một biểu đồ cột tương tác thể hiện doanh số của từng sản phẩm.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Plotly dùng mã để tạo biểu đồ. Bạn có thể chọn một trong hai cách dùng: Plotly Express, đơn giản và nhanh hơn cho các biểu đồ thông thường, hoặc Graph Objects, cho quyền kiểm soát nhiều hơn với các biểu đồ phức tạp.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Plotly

Python graphing library for creating interactive, publication-quality visualizations with 40+ chart types.

When to Use

  • You need interactive charts with hover, zoom, pan, or web embedding.
  • You are building dashboards, exploratory analysis notebooks, or presentations that benefit from rich interaction.
  • You want to choose between Plotly Express and Graph Objects for the same visualization task.

Quick Start

Install Plotly:

uv pip install plotly

Basic usage with Plotly Express (high-level API):

import plotly.express as px
import pandas as pd

df = pd.DataFrame({
    'x': [1, 2, 3, 4],
    'y': [10, 11, 12, 13]
})

fig = px.scatter(df, x='x', y='y', title='My First Plot')
fig.show()

Choosing Between APIs

Use Plotly Express (px)

For quick, standard visualizations with sensible defaults:

  • Working with pandas DataFrames
  • Creating common chart types (scatter, line, bar, histogram, etc.)
  • Need automatic color encoding and legends
  • Want minimal code (1-5 lines)

See reference/plotly-express.md for complete guide.

Use Graph Objects (go)

For fine-grained control and custom visualizations:

  • Chart types not in Plotly Express (3D mesh, isosurface, complex financial charts)
  • Building complex multi-trace figures from scratch
  • Need precise control over individual components
  • Creating specialized visualizations with custom shapes and annotations

See reference/graph-objects.md for complete guide.

Note: Plotly Express returns graph objects Figure, so you can combine approaches:

fig = px.scatter(df, x='x', y='y')
fig.update_layout(title='Custom Title')  # Use go methods on px figure
fig.add_hline(y=10)                     # Add shapes

Core Capabilities

1. Chart Types

Plotly supports 40+ chart types organized into categories:

Basic Charts: scatter, line, bar, pie, area, bubble

Statistical Charts: histogram, box plot, violin, distribution, error bars

Scientific Charts: heatmap, contour, ternary, image display

Financial Charts: candlestick, OHLC, waterfall, funnel, time series

Maps: scatter maps, choropleth, density maps (geographic visualization)

3D Charts: scatter3d, surface, mesh, cone, volume

Specialized: sunburst, treemap, sankey, parallel coordinates, gauge

For detailed examples and usage of all chart types, see reference/chart-types.md.

2. Layouts and Styling

Subplots: Create multi-plot figures with shared axes:

from plotly.subplots import make_subplots
import plotly.graph_objects as go

fig = make_subplots(rows=2, cols=2, subplot_titles=('A', 'B', 'C', 'D'))
fig.add_trace(go.Scatter(x=[1, 2], y=[3, 4]), row=1, col=1)

Templates: Apply coordinated styling:

fig = px.scatter(df, x='x', y='y', template='plotly_dark')
# Built-in: plotly_white, plotly_dark, ggplot2, seaborn, simple_white

Customization: Control every aspect of appearance:

  • Colors (discrete sequences, continuous scales)
  • Fonts and text
  • Axes (ranges, ticks, grids)
  • Legends
  • Margins and sizing
  • Annotations and shapes

For complete layout and styling options, see reference/layouts-styling.md.

3. Interactivity

Built-in interactive features:

  • Hover tooltips with customizable data
  • Pan and zoom
  • Legend toggling
  • Box/lasso selection
  • Rangesliders for time series
  • Buttons and dropdowns
  • Animations
# Custom hover template
fig.update_traces(
    hovertemplate='<b>%{x}</b><br>Value: %{y:.2f}<extra></extra>'
)

# Add rangeslider
fig.update_xaxes(rangeslider_visible=True)

# Animations
fig = px.scatter(df, x='x', y='y', animation_frame='year')

For complete interactivity guide, see reference/export-interactivity.md.

4. Export Options

Interactive HTML:

fig.write_html('chart.html')                       # Full standalone
fig.write_html('chart.html', include_plotlyjs='cdn')  # Smaller file

Static Images (requires kaleido):

uv pip install kaleido
fig.write_image('chart.png')   # PNG
fig.write_image('chart.pdf')   # PDF
fig.write_image('chart.svg')   # SVG

For complete export options, see reference/export-interactivity.md.

Common Workflows

Scientific Data Visualization

import plotly.express as px

# Scatter plot with trendline
fig = px.scatter(df, x='temperature', y='yield', trendline='ols')

# Heatmap from matrix
fig = px.imshow(correlation_matrix, text_auto=True, color_continuous_scale='RdBu')


…
Câu hỏi thường gặp

Tôi có thể lưu biểu đồ để dùng ở nơi khác không?

Có, bạn có thể lưu biểu đồ dưới dạng tệp HTML tương tác hoặc hình ảnh tĩnh (PNG, PDF, SVG).

Plotly có tốt cho biểu đồ khoa học không?

Có, Plotly có nhiều loại biểu đồ cho dữ liệu khoa học, như bản đồ nhiệt (heatmap) và biểu đồ 3D.

Khác biệt giữa Plotly Express và Graph Objects là gì?

Plotly Express dễ dùng và nhanh hơn cho biểu đồ tiêu chuẩn. Graph Objects cung cấp nhiều tùy chỉnh và kiểm soát hơn cho các biểu đồ nâng cao hoặc đặc biệt.

Chi tiết

Mô tả gốc của tác giả

Interactive visualization library. Use when you need hover info, zoom, pan, or web-embeddable charts. Best for dashboards, exploratory analysis, and presentations. For static publication figures use matplotlib or scientific-visualization.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5458
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự