plotly/polar-bar-area
| Rule | polar-bar-area |
|---|---|
| Pack | plotly |
| Severity | warning |
| Fix | none, edit by hand |
| Library versions | every version |
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.
Message
Section titled “Message”xpd prints this message with the issue. A name that starts with $ stands for code from your file.
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.Browse the other rules of the plotly pack.