The plotly pack applies Edward Tufte's "The Visual Display of Quantitative Information" (second edition) to files that import plotly or set pandas's plotting backend to "plotly". Pair the pack with xpd charts to check principles that require inspecting rendered data and layout.
Rules
Safe fix
Unsafe fix
Manual fix
26
0
12
14
The Plotly Express rules also read pandas calls such as df.plot.bar(x="team", y="score") when
the file selects Plotly as its sole plotting backend and the call supplies its arguments by name.
Python file Imports plotly or sets pandas plotting.backend = 'plotly' Verify plotly module and local go.Figure bindings Report distorted sizes, chartjunk, unordered colors, weak chart forms, and labels
Rule
Severity
Fix
What it finds
marker-size-diameter
error
unsafe
plotly reads marker size as a diameter by default, so the area of a marker grows with the square of the value.
bar-axis-without-zero
warning
unsafe
A bar chart whose value axis starts above zero draws bars whose length no longer follows their value.
area-axis-without-zero
warning
unsafe
An area chart whose value axis starts above zero draws fills whose height no longer follows their value.
polar-bar-area
warning
none
A polar bar draws each value as a wedge whose area grows with the square of the value.
three-d-for-two-d
error
unsafe
A 3D trace without a real third variable either draws nothing or adds a dimension the data does not have.
dual-y-axis
info
none
With two overlaid y axes, where the lines cross depends on the two ranges you pick and not on the data.
free-facet-scales
info
unsafe
matches=None gives each facet its own scale, so the same value sits at a different height in each panel.
mercator-choropleth
warning
none
A Mercator or equirectangular projection stretches land far from the equator, so shaded regions near the poles look larger than their data warrants.
Rule
Severity
Fix
What it finds
default-template
info
unsafe
plotly's default template tints the plot area (#E5ECF6) and draws 10 white grid lines, which is ink that shows no data.
explicit-grid
info
unsafe
showgrid=True without a muted color draws a grid line at every tick that competes with the data.
boxed-axis-frame
info
unsafe
mirror=True repeats the axis line on the far side of the plot, which closes a box around the data and adds ink that shows nothing.
box-plot-ink
info
none
A box plot of one variable draws outlines that a five-number summary does not need.
redundant-color
info
unsafe
Coloring by the same column that an axis already shows encodes one variable twice and adds a legend for nothing.
pattern-fill
warning
none
Hatching groups with pattern_shape makes the chart shimmer, which Tufte calls the most common kind of clutter.
gauge-indicator
info
none
A gauge spends a whole dial on one number.
Rule
Severity
Fix
What it finds
rainbow-colorscale
warning
unsafe
A rainbow colorscale such as Jet rises and falls in lightness, so it makes edges in the data that are not there.
Rule
Severity
Fix
What it finds
pie-chart
warning
none
A pie chart makes the reader compare angles, with no numbers on a common scale.
sunburst-as-pie
warning
none
A sunburst draws each value as a wedge, and wedges in an outer ring get more area for each degree, so areas do not follow values.
spline-line
info
unsafe
A spline line can pass through values the data does not hold.
animation-frame
info
none
An animation shows one frame at a time, so the reader compares frames from memory.
heatmap-smoothing
info
unsafe
zsmooth blends the colors of neighboring cells, so the heatmap shows values the data does not hold.
table-for-small-data
info
none
A bar chart of a few numbers written in the code shows them as bar lengths and writes none of them.
Rule
Severity
Fix
What it finds
all-caps-title
info
none
A title in capitals only is wider and slower to read, because every word has the same rectangular outline.
legend-instead-of-labels
info
none
A legend for a few lines makes the reader look back and forth between the legend and the lines.
rotated-tick-labels
info
none
Tick labels turned away from the horizontal are harder to read.
axis-title-column-name
info
none
Without labels, plotly puts the column name, such as gdpPercap, on the axis as its title.