如何使用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绘制多个饼图的其他方法是什么?
答案 0 :(得分:0)
在这种情况下,域名意味着什么?
domain
指定图表将放置在哪个矩形中。
,例如:domain
:
domain={'x': [0, .5], 'y': [0, 1.0]},
表示:
'x': [0, .5]
:将图表放在图像的左半边,即总宽度的0.0到0.5之间。'y': [0, 1.0]
:占据图片的整个高度