@@ -0,0 +1,2000 @@
+%22%22%22%0AConnections Among U.S. Airports Interactive%0A-------------------------------------------%0AThis example shows all the connections between major U.S. airports. Lookup transformations %0Aare used to find the coordinates of each airport and connecting airports. Connections %0Aare displayed on mouseover via a single selection.%0A%22%22%22%0A# category: case studies%0Aimport altair as alt%0Afrom vega_datasets import data%0A%0A# Since these data are each more than 5,000 rows we'll import from the URLs%0Aairports = data.airports.url%0Aflights_airport = data.flights_airport.url%0A%0Astates = alt.topo_feature(data.us_10m.url, feature=%22states%22)%0A%0A# Create mouseover selection%0Aselect_city = alt.selection_single(%0A    on=%22mouseover%22, nearest=True, fields=%5B%22origin%22%5D, empty=%22none%22%0A)%0A%0A# Define which attributes to lookup from airports.csv%0Alookup_data = alt.LookupData(%0A    airports, key=%22iata%22, fields=%5B%22state%22, %22latitude%22, %22longitude%22%5D%0A)%0A%0Abackground = alt.Chart(states).mark_geoshape(%0A    fill=%22lightgray%22, %0A    stroke=%22white%22%0A).properties(%0A    width=750, %0A    height=500%0A).project(%22albersUsa%22)%0A%0Aconnections = alt.Chart(flights_airport).mark_rule(opacity=0.35).encode(%0A    latitude=%22latitude:Q%22,%0A    longitude=%22longitude:Q%22,%0A    latitude2=%22lat2:Q%22,%0A    longitude2=%22lon2:Q%22%0A).transform_lookup(%0A    lookup=%22origin%22, %0A    from_=lookup_data%0A).transform_lookup(%0A    lookup=%22destination%22, %0A    from_=lookup_data, %0A    as_=%5B%22state%22, %22lat2%22, %22lon2%22%5D%0A).transform_filter(%0A    select_city%0A)%0A%0Apoints = alt.Chart(flights_airport).mark_circle().encode(%0A    latitude=%22latitude:Q%22,%0A    longitude=%22longitude:Q%22,%0A    size=alt.Size(%22routes:Q%22, scale=alt.Scale(range=%5B0, 1000%5D), legend=None),%0A    order=alt.Order(%22routes:Q%22, sort=%22descending%22)%0A).transform_aggregate(%0A    routes=%22count()%22, %0A    groupby=%5B%22origin%22%5D%0A).transform_lookup(%0A    lookup=%22origin%22, %0A    from_=lookup_data%0A).transform_filter(%0A    (alt.datum.state != %22PR%22) & (alt.datum.state != %22VI%22)%0A).add_selection(%0A    select_city%0A)%0A%0A(background + connections + points).configure_view(stroke=None)%0A

Add example for Connections Among U.S. Airports Interactive