liveBook · Manning

Configure_*()

As explained in Data Storytelling with Altair and AI

configure_view() is an Altair chart method that sets view-level configuration properties for single or compound charts.

Altair’s configure_*() methods apply presentation settings to chart components. Use configure_view() for the chart’s general view, while related methods target axes, titles, text, or legends. section 3.2.6 section 8.3.1

Use configuration deliberately to improve clarity without overwhelming the visualization:

  • Remove or adjust the view border with strokeWidth and stroke. section 3.2.6
  • Set the view background with fill. section 3.2.6
  • Use configure_view(width=..., height=...) when sizing single or compound charts; use properties(width=..., height=...) for single charts. section 8.3.2
  • Coordinate view settings with configure_axis() and configure_title() so the whole chart has a consistent visual treatment. section 3.3.1

Remove the default view border

chart = chart.configure_view( strokeWidth=0, stroke='#80C11E', fill='#E0E0E0' ) chart.save('configure-view.html') Here, strokeWidth removes the border, stroke sets its color if present, and fill changes the general view background. Compare the result with the default chart to judge whether the styling supports the intended reading. section 3.2.6

Listing 3.22 Configuring view
chart = chart.configure_view(
    strokeWidth=0,           #1
    stroke='#80C11E',    #2
    fill='#E0E0E0'    #3
)

chart.save('configure-view.html')

Inspect the complete configure_view() listing and its corresponding before-and-after layout comparison. section 3.2.6

How Data Storytelling with Altair and AI covers it

How deep it goes
Demonstrates method selection and concrete parameters, but stops short of detailing the full configuration API.
Examples
Uses a bar chart and a layered population chart with border, stroke, fill, width, height, axis, and title settings.
What it assumes
Assumes familiarity with basic Altair charts and teaches configuration through concrete chart examples.
What you can do after
Operate/configure Altair charts by applying view styling, sizing choices, and coordinated component settings.
How it connects
Connects view configuration with Altair charts, chart size, configure_axis(), configure_title(), font size, and compound charts.

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.