在matplotlib或其他Python包中如何绘制3D饼图?

4
有没有一种方法可以在matplotlib中呈现3D饼图,或者有没有一个Python包可以生成3D饼图?编辑:我实际上已经知道{{link1:pygooglechart}},但我正在寻找可以离线完成的东西。对于那些提供pygooglechart的人,感谢你们的努力,你们有我的支持。问题仍然开放,欢迎提出更多想法。
2个回答

5

当然可以使用pygooglecharts,它是Google Charts的Python包装器。

PyPi:pygooglechat 0.4.0: 发布日期: 2014年4月20日

Github:pygooglechart项目已被废弃

例如:

from pygooglechart import PieChart3D

def python_pie3D() :
  # initialize chart object, 250 x 250 pixels
  chart = PieChart3D(250, 250)

  # pass your data to the chart object
  chart.add_data([398, 294, 840, 462])

  # make labels for the slices
  chart.set_pie_labels("Lithuania Bulgaria Ukraine Romania".split())

  # render the image
  chart.download('revenue_east_europe.png')

alt text


0
from pychartdir import *

#Data
data = [50, 12, 3,35]

# Labels
labels = ["a", "b", "c", "d"]

# Set pixel
c= PieChart(500, 300)

# set center
c.setPieSize(250, 140, 100)

# Add title
c.addTitle("title")

# Draw
c.set3D()

# Set lebel
c.setData(data, labels)

# Explode all
c.setExplode()

# Output
c.makeChart("threedpie.png")

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接