Skip to content

Commit be0a29e

Browse files
separated update_xaxes from update_layout
1 parent aa96405 commit be0a29e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

+8-5
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,15 @@ for col in ["Disagree","Strongly Disagree","Agree","Strongly Agree"]:
266266
marker=dict(color=color_by_category[col]),
267267
legendrank=legend_rank_by_category[col]
268268
))
269+
269270
fig.update_layout(
270271
title="Reactions to statements from the 2002 General Social Survey:",
271-
xaxis=dict(
272+
yaxis_title = "",
273+
barmode='relative', # Allows bars to diverge from the center
274+
plot_bgcolor="white",
275+
)
276+
277+
fig.update_xaxes(
272278
title="Percent of Responses",
273279
zeroline=True, # Ensure there's a zero line for divergence
274280
zerolinecolor="black",
@@ -277,11 +283,8 @@ fig.update_layout(
277283
tickmode = 'array',
278284
tickvals = [-50, 0, 50, 100],
279285
ticktext = [50, 0, 50, 100]
280-
),
281-
yaxis_title = "",
282-
barmode='relative', # Allows bars to diverge from the center
283-
plot_bgcolor="white",
284286
)
287+
285288
fig.show()
286289
```
287290

0 commit comments

Comments
 (0)