I know how to set the width of bars in a bar chart:
fig = go.Figure(data=[go.Bar(x = ['A', 'B', 'C'], y = [2, 4, 1], width=[0.5]*3)])
fig.update_layout(paper_bgcolor = 'rgba(0,0,0,0)',plot_bgcolor = 'rgba(0,0,0,0)')
fig.update_layout(bargap=0)
fig.show()
As you can see, the bargap
is ignored. Because the width of bars has been set. Now, by removing the width
property, we will get the following:
I desire by removing the gaps, have a thinner bar chart in the meanwhile.
Now, the question is:
"How to set width and gap simultaneously in a bar chart through plotly in python?"
question from:
https://stackoverflow.com/questions/65938194/how-to-set-width-and-gap-simultaneously-in-a-bar-chart-python-plotly 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…