Plotly is an interactive, open-source visualization library for Python that creates publication-quality graphs with minimal code, while Dask is a flexible parallel computing library that scales Python data science workflows from single machines to clusters. Together, they form a powerful toolkit for modern data analysis: Plotly excels at transforming data into compelling visual stories with interactivity built-in, while Dask enables you to handle datasets larger than RAM by intelligently chunking and parallelizing computations. The key mental model to keep in mind is that Plotly operates on computed results (whether from pandas or Dask), while Dask operates lazily — building a task graph that only executes when you explicitly call .compute() or .persist(). Since Dask 2024.3.0, the DataFrame backend uses dask-expr with logical query planning enabled by default, bringing significant performance improvements.
What This Cheat Sheet Covers
This topic spans 22 focused tables and 157 indexed concepts, 109 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
Table 1: Plotly Core Chart Types
The everyday chart vocabulary lives here — the plots you'll build ninety percent of the time. They span the four basic questions of visualisation: how two variables relate (scatter, line), how values compare across categories (bar), how a single variable is distributed (histogram, box, violin, ECDF), and how parts make up a whole or sit on a map (pie, treemap, choropleth). Most are a single Plotly Express call away.
| Type | Example | Description | |
|---|---|---|---|
import plotly.express as pxfig = px.scatter(df, x='col1', y='col2') | • Visualizes relationships between two continuous variables • supports color, size, and hover customization. | ||
fig = px.line(df, x='date', y='value') | • Displays trends over time or continuous data • ideal for time-series with automatic date formatting. | ||
fig = px.bar(df, x='category', y='count') | • Represents categorical data using rectangular bars • supports grouped, stacked, and horizontal orientations. | ||
fig = px.histogram(df, x='values', nbins=30) | • Shows distribution of a single continuous variable by binning values • automatically calculates counts. | ||
fig = px.box(df, x='group', y='values') | • Displays five-number summary (min, Q1, median, Q3, max) plus outliers • useful for comparing distributions. | ||
fig = px.violin(df, x='group', y='values') | • Combines box plot with kernel density estimation • reveals distribution shape more clearly than box plots. | ||
fig = px.strip(df, x='group', y='values') | • Plots individual data points as a jitter strip over categories • useful when sample size is small enough to show every point. | ||
fig = px.ecdf(df, x='values') | • Empirical cumulative distribution function • shows the fraction of data at or below each value without binning. | ||
import plotly.graph_objects as gofig = go.Figure(data=go.Heatmap(z=matrix)) | • Visualizes matrix data using color gradients • commonly used for correlation matrices and 2D density. | ||
fig = px.density_heatmap(df, x='col1', y='col2') | • Aggregates data into a 2D grid and colors by count or aggregate • shows joint distribution of two continuous variables. | ||
fig = px.density_contour(df, x='col1', y='col2') | • Draws contour lines over the 2D density of data points • similar to density heatmap but as isolines. | ||
fig = px.pie(df, names='category', values='amount') | • Shows part-to-whole relationships as slices • supports donut variant with hole parameter. | ||
fig = px.sunburst(df, path=['level1', 'level2'], values='val') | • Displays hierarchical data as concentric rings • interactive drill-down by clicking segments. | ||
fig = px.treemap(df, path=['level1', 'level2'], values='val') | • Represents hierarchical data using nested rectangles • size and color encode different metrics. | ||
fig = px.choropleth(df, locations='country', color='value') | • Creates geographic outline maps with regions colored by data values • uses built-in country/state boundaries. | ||
fig = px.scatter_mapbox(df, lat='lat', lon='lon') | • Plots points on Mapbox tile maps • requires Mapbox token for advanced styles. | ||
fig = px.scatter_map(df, lat='lat', lon='lon') | • Plots points on MapLibre tile maps • newer alternative to scattermapbox — no Mapbox token required. | ||
fig = px.scatter_3d(df, x='x', y='y', z='z') | • Creates three-dimensional scatter plots with rotation and zoom • ideal for multivariate exploration. | ||
fig = go.Figure(data=go.Contour(z=matrix)) | • Shows isolines of a 3D surface on a 2D plane • useful for visualizing functions of two variables. | ||
fig = go.Figure(data=go.Sankey(node=nodes, link=links)) | • Visualizes flow between nodes with weighted connections • commonly used for process flows and transfers. | ||
fig = px.funnel(df, x='values', y='stage') | • Displays progressive reduction through sequential stages • typical for sales pipelines and conversion funnels. | ||
fig = go.Figure(data=go.Scattergl(x=x, y=y)) | • Uses WebGL rendering for scatter plots with millions of points • drop-in replacement for go.Scatter when performance matters. |