mirror of
https://github.com/aykhans/AzSuicideDataVisualization.git
synced 2025-04-21 18:23:35 +00:00
29 lines
692 B
Python
29 lines
692 B
Python
"""
|
|
Repeated Choropleth Map
|
|
=======================
|
|
Three choropleths representing disjoint data from the same table.
|
|
"""
|
|
# category: maps
|
|
import altair as alt
|
|
from vega_datasets import data
|
|
|
|
states = alt.topo_feature(data.us_10m.url, 'states')
|
|
source = data.population_engineers_hurricanes.url
|
|
variable_list = ['population', 'engineers', 'hurricanes']
|
|
|
|
alt.Chart(states).mark_geoshape().encode(
|
|
alt.Color(alt.repeat('row'), type='quantitative')
|
|
).transform_lookup(
|
|
lookup='id',
|
|
from_=alt.LookupData(source, 'id', variable_list)
|
|
).properties(
|
|
width=500,
|
|
height=300
|
|
).project(
|
|
type='albersUsa'
|
|
).repeat(
|
|
row=variable_list
|
|
).resolve_scale(
|
|
color='independent'
|
|
)
|