TitleParams() configures an Altair chart title and related context, including title text, subtitles, font sizes, and spacing. It helps turn a chart from information into a more understandable data story. section 5.2.2 section 5.5.2
Use TitleParams() to control presentation details such as:
- title: the main chart heading, supplied as text or multiple text lines. section 5.2.2
- subtitle: explanatory context that guides attention toward the data. section 5.2.2 section 5.5.2
- subtitleFontSize and fontSize: text sizing for subtitles and titles. section 5.2.2
Adding context to a homelessness chart
chart = chart.properties( width=500, title=alt.TitleParams( text=["Together, Let's Make a Difference:", "Support Our Project to Help the Homeless!"], subtitle=[ "Homelessness is a heartbreaking reality that leaves individuals and families without a stable home,", "leading to devastating consequences such as poor health and social isolation.", "The chart describes the number of homeless people in Italy per 1,000 inhabitants, organized by region.", "The data is from 2021, the most recent year available (Source: ISTAT)." ], subtitleFontSize=18 ) ) The title states the appeal, while the subtitle supplies human and statistical context.
