0% found this document useful (0 votes)
11 views3 pages

Plotly_Cheatsheet

The document is a cheatsheet for Plotly in Python, detailing the high-level API (Plotly Express) and low-level API (Plotly Graph Objects) for creating various chart types. It includes functions, key parameters for each chart type, layout customization options, and styling templates. Additionally, it summarizes when to use each API based on simplicity, control, and ideal use cases.

Uploaded by

Dipayan Mohanta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views3 pages

Plotly_Cheatsheet

The document is a cheatsheet for Plotly in Python, detailing the high-level API (Plotly Express) and low-level API (Plotly Graph Objects) for creating various chart types. It includes functions, key parameters for each chart type, layout customization options, and styling templates. Additionally, it summarizes when to use each API based on simplicity, control, and ideal use cases.

Uploaded by

Dipayan Mohanta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

📊 Plotly Cheatsheet (Python)

🔹 Plotly Express (`px`) — High-Level API


Chart Type Function Key Parameters

Scatter px.scatter() x, y, color, size, symbol,


hover_name, facet_row,
facet_col

Line px.line() x, y, color, line_group,


markers, hover_name

Bar px.bar() x, y, color, barmode,


facet_row, facet_col

Histogram px.histogram() x, color, nbins, barmode,


histfunc

Box px.box() x, y, color, points, notched

Pie px.pie() names, values, color, hole

Treemap px.treemap() path, values, color,


hover_name

Sunburst px.sunburst() path, values, color

Density Heatmap px.density_heatmap() x, y, z, nbinsx, nbinsy,


color_continuous_scale

Scatter 3D px.scatter_3d() x, y, z, color, symbol, size

Choropleth px.choropleth() locations, color,


locationmode, hover_name,
scope

🔹 Plotly Graph Objects (`go`) — Low-Level API


Chart Type Class Key Parameters

Scatter go.Scatter() x, y, mode, marker=dict(),


name, text, hoverinfo

Line go.Scatter() line=dict(shape="linear") +


common scatter args

Bar go.Bar() x, y, name,


marker=dict(color=""),
orientation

Histogram go.Histogram() x, nbinsx, histfunc,


marker=dict()

Box go.Box() y, name, boxpoints,


marker=dict()

Pie go.Pie() labels, values, hole, pull,


textinfo

Heatmap go.Heatmap() z, x, y, colorscale,


colorbar=dict()

Surface go.Surface() z, x, y, colorscale, contours

Scatter3D go.Scatter3d() x, y, z, mode,


marker=dict(size=)

Choropleth go.Choropleth() locations, z, locationmode,


colorscale, colorbar=dict()

Treemap go.Treemap() labels, parents, values,


branchvalues

Sunburst go.Sunburst() labels, parents, values,


branchvalues

🔧 Layout Customization

fig.update_layout(
title='My Plot',
xaxis_title='X Axis',
yaxis_title='Y Axis',
template='plotly_dark'
)

🎨 Styling Templates
Use in layout:
fig.update_layout(template='plotly_dark')
Popular templates: plotly, plotly_white, plotly_dark, ggplot2, seaborn, simple_white,
presentation

✅ Summary: When to Use


Feature plotly.express plotly.graph_objects

Simplicity ✅ ❌

Fine Control ❌ ✅

Subplots ❌ (limited) ✅

Multiple Traces ❌ ✅

Custom Annotations ❌ ✅

3D, Maps, Layouts Basic Advanced

Ideal For Quick EDA Dashboards & Reports

You might also like