如何使用 plotly 绘制 2 个以上的饼图?例如,如何在两个饼图中再放置两个图,如 here 所示:
`import plotly.plotly as py
import plotly.graph_objs as go
fig = {
"data": [
{
"values": [16, 15, 12, 6, 5, 4, 42],
"labels": [
"US",
"China",
"European Union",
"Russian Federation",
"Brazil",
"India",
"Rest of World"
],
"domain": {"x": [0, .48]},
"name": "GHG Emissions",
"hoverinfo":"label+percent+name",
"hole": .4,
"type": "pie"},
{
"values": [27, 11, 25, 8, 1, 3, 25],
"labels": [
"US",
"China",
"European Union",
"Russian Federation",
"Brazil",
"India",
"Rest of World"
],
"text":"CO2",
"textposition":"inside",
"domain": {"x": [.52, 1]},
"name": "CO2 Emissions",
"hoverinfo":"label+percent+name",
"hole": .4,
"type": "pie"
}],
}}
py.iplot(fig, filename='donut')
在这种情况下域是什么意思?使用 plotly 绘制多个饼图的替代方法有哪些?
最佳答案
What does domain mean in this case?
domain
指定图表将放置在哪个矩形中。
例如,域
:
domain={'x': [0, .5], 'y': [0, 1.0]},
意思是:
'x': [0, .5]
:将图形放在图像的左半边,即总宽度的 0.0 到 0.5。'y': [0, 1.0]
:占据图片的全高
关于python - 如何从 Python 中并排绘制多个饼图?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47434590/