configure_axis() is an Altair chart method for setting default properties shared by both axes, including labels, titles, tick marks, and scales. section 3.2.6
Choose the axis configuration method that matches the scope of the change:
- Use configure_axis() for both axes. section 3.2.6
- Use configure_axisX() or configure_axisY() when only one axis needs configuration. section 3.2.6
- Use properties() for basic chart properties, while global configuration methods handle broader chart settings. section 3.2.6
Make axis labels horizontal and readable
Starting with a bar chart, apply shared axis settings and save the result: chart = chart.configure_axis( labelAngle=0, titleFontSize=14, labelFontSize=12 ) chart.save('configure-axis.html') The same method can remove grid lines when a cleaner presentation is needed: chart.configure_axis(grid=False). section 3.2.6 section 3.3.1
Listing 3.20 Configuring axes
chart = chart.configure_axis(
labelAngle=0, #1
titleFontSize=14, #2
labelFontSize=12 #3
)
chart.save('configure-axis.html')
Inspect the compact Listing 3.20 example showing shared label angle and font settings. section 3.2.6
