【问题标题】:3D pie graph in matplotlib or other python packagematplotlib 或其他 python 包中的 3D 饼图
【发布时间】:2011-03-27 02:10:58
【问题描述】:

有没有办法在 matplotlib 中渲染 3D 饼图,或者有没有 Python 包可以生成 3D 饼图?

编辑:我实际上已经知道pygooglechart,但我正在寻找可以离线完成的东西。对于忘记包含此信息,我深表歉意。对于那些提供pygooglechart 的人,感谢您的努力,您有我的投票。问题仍有待更多想法。

【问题讨论】:

    标签: python matplotlib 3d pie-chart pygooglechart


    【解决方案1】:

    当然,您可以使用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')
    

    【讨论】:

      【解决方案2】:
      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")
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-08-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多