我想以百分比的形式显示x轴上的数据。你知道吗
我尝试了不同的方法,包括#tickformat方法,但未能成功获得所需的输出。你知道吗
trace4 = go.Bar(
y=[''],
x=[5731],
name='Other(Used/Available)',
text = ("5731"),
textposition = 'inside',
orientation = 'h',
marker = dict(
color = 'rgba(210, 105, 30, 0.6)',
line = dict(
color = 'rgba(210, 105, 30, 1.0)',
width = 3)
)
)
data = [trace1, trace2, trace3, trace4]
layout = go.Layout(
autosize=False,
width=800,
height=275,
barmode='stack',
xaxis=dict(tickformat="%")
)
fig = go.Figure(data=data, layout=layout)
py.iplot(fig, filename='marker-h-bar')
好吧,我自己想出来的。我计算了总数,然后用这种方法计算了百分比。之后,只需使用
xaxis=dict(ticksuffix="%")
来分配“%”符号。你知道吗相关问题 更多 >
编程相关推荐