1
votes

I would like to set legend position to "Show legend without overlapping the chart". How do I do this?

I see that I can set the legend position through:

from pptx.enum.chart import XL_LEGEND_POSITION

chart.has_legend = True

chart.legend.position = XL_LEGEND_POSITION.BOTTOM

There's a CUSTOM option for XL_LEGEND_POSITION according to the documentation. Is there a way I can use the CUSTOM option to specify that I would like to show legend without overlapping chart? Below is a screenshot of the Powerpoint option to do this: "Show legend without overlapping the chart" select box

1

1 Answers

2
votes

I think what you're looking for is .include_in_layout on the Legend object:

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