liveBook · Manning

Independent scale

As explained in Data Storytelling with Altair and AI

An independent scale is a visualization scale resolved separately for one component of a composed chart rather than shared across components.

An independent scale resolves a visualization scale separately for each component of a composed chart. This prevents layered or concatenated views from being forced onto shared x, y, or color scales. section 9.2.1

Applying independent scales in Altair

After combining context, annotations, an image, rectangles, lines, and labels, call resolve_scale(color='independent', x='independent', y='independent'). The resulting chart saves as an HTML file. section 9.2.1

Listing 9.6 Building the final chart
chart = ((context | (chart + annotation + img)) & (rect + line + text)
).configure_view(
    strokeWidth=0
).resolve_scale(
    color='independent',
    x='independent',
    y='independent'
).configure_axis(
    grid=False
)

chart.save('pets-visualized-roadmap.html')

Inspect the complete composed-chart configuration, including independent color, x, and y scales. section 9.2.1

How Data Storytelling with Altair and AI covers it

How deep it goes
Demonstrates the configuration call for color, x, and y scales but does not explain scale-resolution internals.
Examples
Uses rectangles, labels, lines, annotations, and an image in a dogs-and-cats campaign roadmap.
What you can do after
Apply it via Altair to configure independent color, x, and y scales in a composed chart.
How it connects
Connects Altair scale resolution with layered and concatenated 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.