Python 如何使用Pychart在piechart中填充颜色

Python 如何使用Pychart在piechart中填充颜色,python,charts,Python,Charts,我正在使用python Pychart。 我已完成以下代码以生成饼图: from pychart import * import sys data = [("foo", 10),("bar", 20), ("baz", 30), ("ao", 40)] theme.get_options() ar = area.T(size=(150,150), legend=legend.T(), x_grid_style = None, y_grid_style = Non

我正在使用python Pychart。 我已完成以下代码以生成饼图:

from pychart import *
import sys

data = [("foo", 10),("bar", 20), ("baz", 30), ("ao", 40)]
theme.get_options()    
ar = area.T(size=(150,150), legend=legend.T(),
            x_grid_style = None, y_grid_style = None)

plot = pie_plot.T(data=data, arc_offsets=[0,0,0,0],
                  shadow = (0, 0, fill_style.gray50),
                  label_offset = 25,
                  arrow_style = arrow.a3)
ar.add_plot(plot)
ar.draw()
它生成具有灰度的饼图。 我希望饼图中有不同的颜色,而不是灰度。
我如何才能做到这一点?

在调用get\u options()之前添加
theme.use\u color=True

主题文件:

使用颜色

此变量的默认值为 错。如果该值为True,则使用PyChart 为某些默认对象着色。 如果该值为False,PyChart将使用 这些颜色的灰度 对象


在调用get_options()之前添加
theme.use_color=True

主题文件:

使用颜色

此变量的默认值为 错。如果该值为True,则使用PyChart 为某些默认对象着色。 如果该值为False,PyChart将使用 这些颜色的灰度 对象


看起来pychart自2006年以来就没有更新过,我建议您看看,也许是python最好的绘图库


饼图示例

看起来pychart自2006年以来就没有更新过,我建议您看看,也许是python最好的绘图库


饼图示例

您必须使用
填充样式
参数指定填充颜色(此列表的长度应与数据长度相同):

它将以颜色工作:)


您必须使用
fill\u styles
参数指定填充颜色(此列表的长度应与数据长度相同):

它将以颜色工作:)

from pychart import *
import sys

data = [("foo", 10),("bar", 20), ("baz", 30), ("ao", 40)]
theme.get_options()    
ar = area.T(size=(150,150), legend=legend.T(),
            x_grid_style = None, y_grid_style = None)

plot = pie_plot.T(data=data, arc_offsets=[0,0,0,0],
                  fill_styles = [fill_style.red, fill_style.blue, fill_style.green, fill_style.yellow],
                  shadow = (0, 0, fill_style.gray50),
                  label_offset = 25,
                  arrow_style = arrow.a3)
ar.add_plot(plot)
ar.draw()