簡體   English   中英

如何從Python中逐個繪制多個餅圖並排繪制?

[英]How to plot multiple pie charts side-by-side in plotly from Python?

如何使用plotly繪制超過2個餅圖? 例如,你怎么把兩個餅圖兩個地塊所看到這里

`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繪制多個餅圖的替代方法有哪些?

在這種情況下,域名意味着什么?

domain指定圖表將放置在哪個矩形中。

例如, domain

domain={'x': [0, .5], 'y': [0, 1.0]},

手段:

  • 'x': [0, .5] :將圖形放在圖像的左半邊,即總寬度的0.0到0.5。
  • 'y': [0, 1.0] :占據圖像的整個高度

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM