Is there a way to render a 3D pie in matplotlib, or is there a Python package that can generate 3D pies开发者_JAVA百科?
EDIT: I actually already knew about pygooglechart
, but I'm looking for something that can be done offline. My apologies for forgetting to include this information. For those who offered pygooglechart
, thanks for the effort, you have my votes. Question is still open for more ideas.
Sure, you can use pygooglecharts, which is a python wrapper for Google Charts.
PyPi: pygooglechat 0.4.0
: Released: Apr 20, 2014
GitHub: pygooglechart
: Project Abandoned
For instance:
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')
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")
精彩评论