The href channel maps a visual mark’s data value to an external resource location. In Altair, it can turn chart text into a link, extending a visualization with sources or next steps. section 9.2.2 section 3.3.2
Use the href channel to connect chart content with supporting actions or evidence:
- Attach a data-source URL to a text mark placed beneath a chart title. section 3.3.2
- Add a learn-more link as a next step in a layered data story. section 9.2.2
Link a chart’s data source
Create a row containing display text and its URL, then encode both fields on a text mark: df_subtitle = pd.DataFrame({'text': ['source: World Bank'], 'href': 'https://data.worldbank.org/indicator/SP.POP.TOTL'}); subtitle = alt.Chart(df_subtitle).mark_text(y=0).encode(text='text', href='href').
