How do you set the font size of a Chart Title with Python PPTX?

Viewed 4488

I add a chart with:

doughnutchart_data.add_series('YTD COMPLETION TO PLAN', (PerformancePercent, NotPerformedPercent))

This gives me a chart title with the text, but how do I change the font size? This:

ThisDoughnutChart.title.font.size = Pt(12)

Gives me this error: AttributeError: 'Chart' object has no attribute 'title'

3 Answers

Version 0.6.11 another example

shape = slide.shapes
title_shape = shape.title
title_shape.text_frame.paragraphs[0].font.size=Pt(10)

You can set the global font size of the chart with the following:

from pptx.util import Inches, Pt

ThisDoughnutChart.font.size = Pt(10)
Related