|
import altair as alt |
|
import streamlit as st |
|
|
|
african_countries = alt.topo_feature( |
|
"https://raw.githubusercontent.com/deldersveld/topojson/master/continents/africa.json", |
|
"continent_Africa_subunits", |
|
) |
|
africa_chart = ( |
|
alt.Chart(african_countries) |
|
.mark_geoshape(stroke="white", strokeWidth=2) |
|
.encode( |
|
color="value:Q", |
|
tooltip=[ |
|
alt.Tooltip("properties.geounit:O", title="Country name"), |
|
alt.Tooltip("value:Q", title="Indicator value"), |
|
], |
|
) |
|
.transform_lookup( |
|
lookup="properties.geounit", |
|
from_=alt.LookupData(filtered_data, "Geo Name", ["value"]), |
|
) |
|
) |
|
st.altair_chart(africa_chart) |