Filter out Countries In Map Projection Using Altair

2 weeks ago 13
ARTICLE AD BOX

I am trying to create a base map projection and I want to filter out Antarctica. I have tried this but it is not working:

import pandas as pd import numpy as np import altair as alt from vega_datasets import data import urllib import json import requests #import topoJSON url = "https://cdn.jsdelivr.net/npm/world-atlas@2/countries-50m.json" countries = alt.topo_feature(url, "countries") # World map world_map = alt.Chart(countries).transform_filter( alt.datum["properties.name"] != "Antarctica").mark_geoshape( fill='lightgray', stroke='white' ).encode( color=alt.value("lightgray") ).project(type="mercator")

Any help is greatly appreciated. Thank you!

Read Entire Article