plotly/polar-bar-area
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| plotly | warning | none, edit by hand | All versions |
A polar bar draws each value as a wedge whose area grows with the square of the value. Draw the same values as a plain bar chart.
fig = px.bar_polar(wind, r="hours", theta="direction")fig = px.bar(wind, x="direction", y="hours")What the rule reports
Section titled “What the rule reports”The rule reports px.bar_polar(...) and go.Barpolar(...).
How to fix it
Section titled “How to fix it”xpd has no automatic fix, so make the change by hand.
A polar bar is a wedge whose radius plotly scales with the value, so the area grows with the square of the value. From 1 to 2 the data grows by 100 percent and the area by 300 percent, a Lie Factor of 3.
| Value | Outer radius in pixels | Area ratio |
|---|---|---|
| 1 | 42.75 | 1 |
| 2 | 85.5 | 4 |
| 3 | 128.25 | 9 |
| 4 | 171 | 16 |
The book adds that "the number of information-carrying (variable) dimensions depicted should not exceed the number of dimensions in the data" (page 71), and a wedge varies in two dimensions to show one number. The radial axis takes the types linear, log, date and category, so no axis type draws the area in proportion.
Questions of the presentation review
Section titled “Questions of the presentation review”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 |
|---|---|---|---|
| lie-factor | 57 | The Lie Factor | Is the size of each mark proportional to its number? Divide the size of an effect in the chart by its size in the data; a Lie Factor outside 0.95 to 1.05 is a distortion. |
| dimensions | 71 | No more dimensions than the data | Does the chart depict more varying dimensions than the data have, through 3D, perspective, areas or volumes for one-dimensional numbers? |
Diagnostic message
Section titled “Diagnostic message”A polar bar is a wedge whose radius follows the value, so its area grows with the square. Wedges for 1, 2, 3 and 4 were drawn with areas in the ratio 1, 4, 9 and 16, which is a Lie Factor of 3 in Tufte's terms. Draw the same values with px.bar, where the length of a bar follows the value.See all rules in the plotly pack.