Skip to content

Commit 28aa4f3

Browse files
removed the (irrelevant) neutral category
1 parent be0a29e commit 28aa4f3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: doc/python/horizontal-bar-charts.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ fig.show()
221221

222222
Diverging bar charts show counts of positive outcomes or sentiments to the right of zero and counts of negative outcomes to the left of zero, allowing the reader to easily spot areas of excellence and concern. Implementing presentation-ready versions of them in Plotly requires a few non standard layout and legendrank options.
223223

224-
```
225-
import pandas as pd
224+
```import pandas as pd
226225
import plotly.graph_objects as go
227226
228227
@@ -235,13 +234,12 @@ for v in ["Disagree","Strongly Disagree"]:
235234
df[v]=df[v]*-1
236235
237236
fig = go.Figure()
238-
# this color palette conveys meaning: blues for negative, reds for positive, gray for Neither Agree nor Disagree
237+
# this color palette conveys meaning: blues for positive, red and orange for negative
239238
color_by_category={
240239
"Strongly Agree":'darkblue',
241240
"Agree":'lightblue',
242241
"Disagree":'orange',
243242
"Strongly Disagree":'red',
244-
"Neither Agree nor Disagree":'gray',
245243
}
246244
247245
@@ -254,7 +252,6 @@ legend_rank_by_category={
254252
"Disagree":2,
255253
"Agree":3,
256254
"Strongly Agree":4,
257-
"Neither Agree nor Disagree":5
258255
}
259256
# Add bars for each category
260257
for col in ["Disagree","Strongly Disagree","Agree","Strongly Agree"]:
@@ -286,6 +283,7 @@ fig.update_xaxes(
286283
)
287284
288285
fig.show()
286+
289287
```
290288

291289
### Bar Chart with Line Plot

0 commit comments

Comments
 (0)