I can't figure out how to increase the size of the font for the chart title in Altair. My code will only change the font size for the axis titles, but not for the chart title.
Here's what I tested out:
data = df
bars = alt.Chart(data, title="This is the Chart Title").mark_bar().encode(
x = 'Feature1',
y = 'Feature2',
color = alt.Color('Feature1', legend=None)).configure_axis(
labelFontSize=16,
titleFontSize=16
)
bars
In this instance, the titleFontSize
argument changes the font for the axis titles ('Feature1'
and 'Feature2'
in this example). Is there any easy way to increase the font for the chart title?
By default Altair uses a linear mapping between the domain values (MIC) and the range values (pixels). To get a better overview of the data, we can apply a different scale transformation. To change the scale type, we'll set the scale attribute, using the alt. Scale method and type parameter.
You can remove the legend entirely by submitting a null value.
We can remove the grid lines on x or y-axis by specifying the argument grid=False inside alt. X() or alt. Y() method in the encoding channels.
When you call configure_axis
, you are only configuring properties related to the axis. If you want to configure the properties of the chart title, you can use configure_title()
; e.g.
bars.configure_title(fontSize=24)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With