Skip to content

plotly/pattern-fill

Pack Severity Fix Versions
plotly warning none, edit by hand All versions

Hatching groups with pattern_shape makes the chart shimmer, which Tufte calls the most common kind of clutter. Tell groups apart with shades of one color, or label them on the chart.

fig = px.bar(df, x="day", y="tip", pattern_shape="shop")
fig = px.bar(df, x="day", y="tip", color="shop", color_discrete_sequence=["#555", "#aaa"])

The rule reports hatching.

Setting Calls
pattern_shape="column" px.area, px.bar, px.bar_polar, px.histogram, px.timeline
a pattern shape on marker.pattern go.Bar, go.Barpolar, go.Funnelarea, go.Histogram, go.Icicle, go.Pie, go.Sunburst, go.Treemap
fillpattern go.Scatter

xpd has no automatic fix, so make the change by hand.

"This moiré vibration, probably the most common form of graphical clutter, is inevitably bad art and bad data graphics" (page 108), and "cross-hatching should be replaced with tint screens of shades of gray" (page 111). px.bar(pattern_shape="sex") resolved the pattern shapes of its two traces to "" and "/", and the drawn figure held two pattern images, where the same chart without the argument held none. go.Bar(marker_pattern_shape="/") and go.Scatter(fillpattern=dict(shape="x")) each drew one.

On a go trace the rule reads marker_pattern_shape=, marker=dict(pattern=dict(shape=...)), fillpattern_shape= and fillpattern=dict(shape=...), with dict(...) or {...}. A shape of "" draws no pattern and is left alone, and so is a shape given by a name.

The rule reports in code what these questions of the presentation guides (xpd charts, xpd tables, and xpd views) ask of the drawn display.

Question Page Principle What it asks
vibration 108 Moire vibration Do hatching, stripes, patterned fills, fields of ticks or doubled lines shimmer? Use flat gray tints or labels in words.
duck 116 The duck Has decoration taken over the chart, so that its structure is a style rather than data?
pattern_shape=$P tells the groups apart by hatching. Tufte calls this moiré vibration the most common form of graphical clutter. Tell the groups apart with shades of one color, or label them on the chart.

See all rules in the plotly pack.