【发布时间】:2019-03-29 12:10:06
【问题描述】:
我正在尝试并排绘制 3 个饼图。我不明白为什么下面的代码使饼图在页面对角向左书写而不是水平向左书写。
这是我的代码:
app.layout = html.Div([
html.Div([
dcc.Graph(id='TPiePlot',
figure={
'data': [go.Pie(labels=labels1,
values=values1,
marker=dict(colors=colors, line=dict(color='#fff', width=1)),
hoverinfo='label+value+percent', textinfo='value',
domain={'x': [0, .25], 'y': [0, 1]}
)
],
'layout': go.Layout(title='T',
autosize=True
)
}
),
dcc.Graph(id='RPiePlot',
figure={
'data': [go.Pie(labels=labels2,
values=values2,
marker=dict(colors=colors, line=dict(color='#fff', width=1)),
hoverinfo='label+value+percent', textinfo='value',
domain={'x': [0.30, .55], 'y': [0, 1]}
)
],
'layout': go.Layout(title='R',
autosize=True
)
}
),
dcc.Graph(id='RoPiePlot',
figure={
'data': [go.Pie(labels=labels3,
values=values3,
marker=dict(colors=colors, line=dict(color='#fff', width=1)),
hoverinfo='label+value+percent', textinfo='value',
domain={'x': [0.60, 0.85], 'y': [0, 1]}
)
],
'layout': go.Layout(title='Ro',
autosize=True
)
}
)
])
])
这是接受答案中选项 1 的情况(这是我需要使用的选项)。我得到了三种不同的尺寸以及覆盖一些饼图的图例:
我很难理解如何使用 CSS 重新调整短划线图的大小,因为整个容器的大小而不是实际图表的大小增加了,而且我不知道如何仅针对图表本身来使大小变大。有没有解决的办法?
【问题讨论】:
标签: python plotly plotly-dash