liveBook · Manning

Resolve_scale()

As explained in Data Storytelling with Altair and AI

resolve_scale() is an Altair chart method that controls whether scales are shared or independent across composed charts.

resolve_scale() controls whether scales are shared or independent across composed Altair charts. Independent scales let each chart component use its own color, x, and y domains. section 9.2.1

Independent scales in a visualized roadmap

Apply the method after composing the context, main chart, annotation, image, rectangles, lines, and labels: chart = ((context | (chart + annotation + img)) & (rect + line + text))\n .resolve_scale(color='independent', x='independent', y='independent') This lets the dogs-and-cats data story combine components with different scale requirements. 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 composition and its resolve_scale() call in the final chart listing. section 9.2.1

How Data Storytelling with Altair and AI covers it

How deep it goes
Demonstrates configuring color, x, and y as independent scales, without detailing scale-resolution internals.
Examples
Uses a dogs-and-cats campaign combining context, bars, annotations, images, rectangles, lines, and labels.
What you can do after
Apply it via Altair to render composed charts whose color, x, and y scales operate independently.
How it connects
Connects composed charts, layered charts, chart concatenation, and visualized roadmaps through independent scale configuration.

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.