Published
Edited
Nov 1, 2021
Importers
Insert cell
# Flights DataVis
Insert cell
Insert cell
dataTemp = await d3.csv(url)
Insert cell
viewof table = Inputs.table(dataTemp, d3.autoType)
Insert cell
Insert cell
headers = ['Airport_ID', 'Name', 'City', 'Country', 'IATA', 'ICAO', 'Latitude', 'Longitude', 'Altitude', 'Timezone', 'DST', 'TZ', 'Type', 'Source']
Insert cell
data2 = aq.loadCSV(url, {header: false, names: headers})
Insert cell
viewof dataTable = Inputs.table(data2)
Insert cell
# Question Examples
### What, Why, Where, When, Who and How
- What is the range of altitude of airport in India?
- What is the average altitude for an airport
- Which country has the most number of airports?
- Which airports are in the same time zones?
- How are the airports distributed across the world?
- Which airports are linked by the most number of connections?
- How many IATA Code of airports are starting with the letter "A"?
- What is the maximum number of airports along a particular latitude?
- What are the total number of airports in each of the countries mention?
Insert cell
Q1. What is the range of altitude in India ?
Insert cell
india_data = d3.filter(data2, d => d.Country == "India")
Insert cell
india_data_table = Inputs.table(india_data)
Insert cell
Plot.plot({
marks: [
Plot.frame({stroke: "grey"}),
Plot.line(d3.sort(india_data, d => d.Altitude), {x: (d, i) => i, y: (d, i) => d.Altitude, stroke: "dodgerblue", strokeWidth: 4})
],
grid: true
})
Insert cell
altitude_min = d3.min(india_data, d => d.Altitude)
Insert cell
altitude_max = d3.max(india_data, d => d.Altitude)
Insert cell
altitude_extent = d3.extent(india_data, d => d.Altitude)
Insert cell
extent_temp = d3.extent(d3.filter(data2, d => d.Country == "India"), d => d.Altitude)
Insert cell
Q2. What is the average altitude for an airport ?
Insert cell
avg_altitude = d3.mean(data2, d => d.Altitude)
Insert cell
Q3. Which country has the most number of airports?
Insert cell
country_airports = d3.sort(d3.rollups(data2, v => v.length, d => d.Country), d => -d[1])[0]
Insert cell
Plot.plot({
width: width,
x: {axis: false},
marks: [
Plot.barY(india_data, Plot.binX({x: (d, i) => i, y: (d, i) => d.Altitude}))
]
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more