liveBook · Manning

Configure_axis()

As explained in Data Storytelling with Altair and AI

configure_axis() is an Altair chart method that sets default properties shared by chart axes.

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

How Data Storytelling with Altair and AI covers it

How deep it goes
Demonstrates method usage with label angles, font sizes, and grid visibility, but does not detail internal rendering behavior.
Examples
Uses a medals bar chart and a population comparison line chart to demonstrate fonts, label angles, and grid removal.
What it assumes
Assumes a basic Altair chart and distinguishes basic properties from global configuration methods.
What you can do after
Operate/configure Altair charts by applying shared axis settings and selecting axis-specific alternatives when needed.
How it connects
Connects axis configuration with configure_axisX(), configure_axisY(), properties(), configure_title(), configure_view(), labels, titles, and scales.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Storytelling with Altair and AI. The section links point to the parts of the book it draws on.