我无法在3D饼图上更改主题或切片的颜色。我的代码是:
$graph = new PieGraph(350,250);
$graph->SetShadow();
$graph->title->SetFont(FF_VERDANA,FS_BOLD,18);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.1,0.9);
// Create 3D pie plot
$p1 = new PiePlot3d($data);
$p1->SetLegends($legends);
$p1->SetTheme("earth");
$p1->SetCenter(0.4);
$p1->SetSize(100);
$p1->SetSliceColors(array("red","blue","yellow","orange"));
$p1->SetAngle(45);
$p1->value->SetFont(FF_ARIAL,FS_BOLD,8);
$p1->value->SetColor("navy");
$graph->Add($p1);
无论我做什么,颜色都不会改变。我想念什么吗?
答案 0 :(得分:2)
在更改主题和颜色之前,将图添加到图形中。如果您考虑一下,这是很有意义的。您必须先创建(定义/添加)某些内容,然后才能对其进行修改。
下面显示的更改应该起作用:
class SupressSettingWithCopyWarning:
def __enter__(self):
pd.options.mode.chained_assignment = None
def __exit__(self, *args):
pd.options.mode.chained_assignment = 'warn'
with SupressSettingWithCopyWarning():
#code that produces warning