Python pptx:"显示图例而不重叠图表"

时间:2017-02-08 18:17:39

标签: python-pptx

我想将图例位置设置为"显示图例而不重叠图表"。我该怎么做?

我看到我可以通过以下方式设置图例位置:

from pptx.enum.chart import XL_LEGEND_POSITION

chart.has_legend = True

chart.legend.position = XL_LEGEND_POSITION.BOTTOM

根据documentation,XL_LEGEND_POSITION有一个CUSTOM选项。有没有办法可以使用CUSTOM选项来指定我想要显示没有重叠图表的图例?以下是执行此操作的Powerpoint选项的屏幕截图: "Show legend without overlapping the chart" select box

1 个答案:

答案 0 :(得分:1)

我认为您在.include_in_layout对象上寻找的是Legend

http://python-pptx.readthedocs.io/en/latest/api/chart.html#legend-objects