Malloy Documentation
search

Scatter charts compare two numeric values.

Model for this example

document
source: flights is duckdb.table('../data/flights.parquet') extend {
  join_one: aircraft is duckdb.table('../data/aircraft.parquet') extend {
    join_one: aircraft_models is duckdb.table('../data/aircraft_models.parquet')
      on aircraft_model_code = aircraft_models.aircraft_model_code 
  } on tail_num = aircraft.tail_num
}
document
# scatter_chart
run: flights -> {
  where: origin = 'ORD'
  group_by: seats is aircraft.aircraft_models.seats
  group_by: distance is distance
  aggregate: route_count is count(concat(origin, destination))
}
QUERY RESULTS
020406080100120140160180200220240260280300320340360380400seats05001,0001,5002,0002,5003,0003,5004,0004,500distance1.01.21.41.61.82.0route_count
[
  {
    "seats": 200,
    "distance": 1437,
    "route_count": 2
  },
  {
    "seats": 179,
    "distance": 1437,
    "route_count": 2
  },
  {
    "seats": 179,
    "distance": 1498,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 137,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1249,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 299,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 733,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1249,
    "route_count": 1
  },
  {
    "seats": 149,
    "distance": 412,
    "route_count": 1
  },
  {
    "seats": 2,
    "distance": 2072,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1498,
    "route_count": 1
  },
  {
    "seats": 182,
    "distance": 491,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 607,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 911,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 240,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1440,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 733,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1197,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1249,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1144,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 264,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 733,
    "route_count": 1
  },
  {
    "seats": 2,
    "distance": 1197,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 693,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 612,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 589,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1005,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1440,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1440,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 783,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 783,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 316,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 264,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 522,
    "route_count": 1
  },
  {
    "seats": 145,
    "distance": 235,
    "route_count": 1
  },
  {
    "seats": 2,
    "distance": 4184,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 612,
    "route_count": 1
  },
  {
    "seats": 70,
    "distance": 412,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 900,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 783,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 2072,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 588,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1144,
    "route_count": 1
  },
  {
    "seats": 70,
    "distance": 678,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1249,
    "route_count": 1
  },
  {
    "seats": 330,
    "distance": 606,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 612,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 733,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1005,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 264,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 528,
    "route_count": 1
  },
  {
    "seats": 2,
    "distance": 4243,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1144,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 286,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1144,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 599,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1440,
    "route_count": 1
  },
  {
    "seats": 55,
    "distance": 316,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1005,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 612,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 589,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1005,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1197,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1197,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 606,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 599,
    "route_count": 1
  },
  {
    "seats": 55,
    "distance": 925,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 589,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1197,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 2116,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 972,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 316,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1012,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1437,
    "route_count": 1
  },
  {
    "seats": 149,
    "distance": 1515,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 606,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 235,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 719,
    "route_count": 1
  },
  {
    "seats": 2,
    "distance": 1182,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1745,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 403,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 528,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 403,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 67,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 316,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 316,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 738,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1745,
    "route_count": 1
  },
  {
    "seats": 400,
    "distance": 1846,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1118,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 585,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 642,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 972,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 972,
    "route_count": 1
  },
  {
    "seats": 37,
    "distance": 316,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 925,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 911,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1120,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1012,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 522,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 978,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 299,
    "route_count": 1
  },
  {
    "seats": 55,
    "distance": 264,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 642,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 606,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 925,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1745,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 528,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 528,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 606,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1182,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 925,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 403,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 196,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1829,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1012,
    "route_count": 1
  },
  {
    "seats": 149,
    "distance": 719,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 296,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 416,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 621,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 888,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 296,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 867,
    "route_count": 1
  },
  {
    "seats": 134,
    "distance": 235,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1721,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1081,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 888,
    "route_count": 1
  },
  {
    "seats": 182,
    "distance": 235,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1515,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1721,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1721,
    "route_count": 1
  },
  {
    "seats": 255,
    "distance": 1846,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1846,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1236,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 409,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 647,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 296,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 177,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 334,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 334,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 647,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 717,
    "route_count": 1
  },
  {
    "seats": 130,
    "distance": 606,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 647,
    "route_count": 1
  },
  {
    "seats": 2,
    "distance": 1846,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 717,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 334,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 888,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 594,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 783,
    "route_count": 1
  },
  {
    "seats": 149,
    "distance": 678,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 137,
    "route_count": 1
  },
  {
    "seats": 134,
    "distance": 491,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 67,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 607,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 607,
    "route_count": 1
  },
  {
    "seats": 55,
    "distance": 719,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 802,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 235,
    "route_count": 1
  },
  {
    "seats": 2,
    "distance": 1745,
    "route_count": 1
  },
  {
    "seats": 182,
    "distance": 334,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 693,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 911,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1829,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 240,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 719,
    "route_count": 1
  },
  {
    "seats": 134,
    "distance": 334,
    "route_count": 1
  },
  {
    "seats": 400,
    "distance": 1721,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 235,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 403,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 719,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 316,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 802,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1120,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 137,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1012,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 240,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 802,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1182,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 911,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 299,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 299,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1120,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1120,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1041,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1829,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 235,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1182,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1182,
    "route_count": 1
  },
  {
    "seats": 255,
    "distance": 1745,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 719,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1829,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 606,
    "route_count": 1
  },
  {
    "seats": 400,
    "distance": 888,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1745,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1041,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1041,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 607,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 678,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 843,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 849,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1723,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1726,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 590,
    "route_count": 1
  },
  {
    "seats": 400,
    "distance": 4243,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 594,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1781,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 837,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 837,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 412,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 843,
    "route_count": 1
  },
  {
    "seats": 130,
    "distance": 264,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 334,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 409,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 849,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1835,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1652,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1781,
    "route_count": 1
  },
  {
    "seats": 70,
    "distance": 612,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 412,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1781,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1739,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 678,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 849,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1723,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1723,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 837,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1726,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 409,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 466,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1835,
    "route_count": 1
  },
  {
    "seats": 149,
    "distance": 1440,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 590,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1726,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 473,
    "route_count": 1
  },
  {
    "seats": 130,
    "distance": 1182,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 416,
    "route_count": 1
  },
  {
    "seats": 55,
    "distance": 740,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 867,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1515,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1721,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 177,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 177,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 334,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1846,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 763,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 621,
    "route_count": 1
  },
  {
    "seats": 149,
    "distance": 316,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 215,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 473,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 621,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1846,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 473,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 621,
    "route_count": 1
  },
  {
    "seats": 149,
    "distance": 925,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 867,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1735,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1515,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 416,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1515,
    "route_count": 1
  },
  {
    "seats": 400,
    "distance": 1745,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 177,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 867,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 416,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 723,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 888,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 296,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1846,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 763,
    "route_count": 1
  },
  {
    "seats": 145,
    "distance": 491,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 2846,
    "route_count": 1
  },
  {
    "seats": 130,
    "distance": 1005,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1739,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 678,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 296,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 1739,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1652,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 594,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 1700,
    "route_count": 1
  },
  {
    "seats": 400,
    "distance": 589,
    "route_count": 1
  },
  {
    "seats": 2,
    "distance": 1723,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 1671,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1726,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 258,
    "route_count": 1
  },
  {
    "seats": 55,
    "distance": 753,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 258,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 723,
    "route_count": 1
  },
  {
    "seats": 149,
    "distance": 599,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 552,
    "route_count": 1
  },
  {
    "seats": 145,
    "distance": 334,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1739,
    "route_count": 1
  },
  {
    "seats": 179,
    "distance": 723,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 849,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 258,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 678,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 843,
    "route_count": 1
  },
  {
    "seats": 172,
    "distance": 723,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1723,
    "route_count": 1
  },
  {
    "seats": 200,
    "distance": 740,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 621,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 416,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1835,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 473,
    "route_count": 1
  },
  {
    "seats": 400,
    "distance": 1197,
    "route_count": 1
  },
  {
    "seats": 22,
    "distance": 177,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 837,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1700,
    "route_count": 1
  },
  {
    "seats": 178,
    "distance": 1781,
    "route_count": 1
  }
]
SELECT 
   aircraft_models_0."seats" as "seats",
   flights."distance" as "distance",
   count(distinct CONCAT(flights."origin",flights."destination")) as "route_count"
FROM '../data/flights.parquet' as flights
 LEFT JOIN '../data/aircraft.parquet' AS aircraft_0
  ON flights."tail_num"=aircraft_0."tail_num"
 LEFT JOIN '../data/aircraft_models.parquet' AS aircraft_models_0
  ON aircraft_0."aircraft_model_code"=aircraft_models_0."aircraft_model_code"
WHERE flights."origin"='ORD'
GROUP BY 1,2
ORDER BY 3 desc NULLS LAST

Run as a trellis

document
run: flights -> {
  group_by: origin
  # scatter_chart
  nest: seats_by_distance_scatter_chart is  {
    group_by: seats is aircraft.aircraft_models.seats
    group_by: distance is distance
    aggregate: route_count is count(concat(origin, destination))
  }
}
QUERY RESULTS
originseats_​by_​distance
ABE
20406080100120140160180seats02004006008001,000distance1route_count
ABI
3638404244464850525456seats150200250300distance1route_count
ABQ
406080100120140160180200seats5001,0001,500distance1route_count
ABY
304050607080seats146distance1route_count
ACK
3638404244464850525456seats218distance1route_count
ACT
37.037.237.437.637.838.038.238.438.638.839.0seats89distance1route_count
ACY
55seats542distance1route_count
AEX
3540455055seats200220240260280distance1route_count
AGS
35404550556065707580seats200400600800distance1route_count
ALB
20406080100120140160180200seats05001,0001,5002,000distance1.01.52.0route_count
AMA
20406080100120140160180seats300400500600700800distance1route_count
ANC
160180200220240260280300320340seats01,0002,0003,0004,000distance1route_count
ATL
050100150200250300350400seats05001,0001,5002,0002,5003,0003,500distance1.01.52.0route_count
ATW
55seats400500600700800distance1route_count
AUS
406080100120140160180200seats05001,0001,500distance1.01.52.0route_count
AVL
406080100120140seats0200400600800distance1route_count
AVP
6080100120140seats100200300400500600700distance1route_count
AZO
55seats225distance1route_count
BDL
050100150200250300350seats05001,0001,5002,0002,500distance1route_count
BFL
55seats1,428distance1route_count
BGM
6080100120140seats250300350400450500distance1route_count
BGR
3638404244464850525456seats2004006008001,000distance1route_count
BHM
20406080100120140160180seats05001,0001,500distance1.01.52.0route_count
BIL
130140150160170180190200seats200300400500600700distance1route_count
BIS
145seats386distance1route_count
BNA
20406080100120140160180200seats05001,0001,5002,000distance1.01.52.0route_count
BOI
406080100120140160180200seats2004006008001,0001,2001,400distance1route_count
BOS
050100150200250300350400seats05001,0001,5002,0002,500distance1route_count
BPT
3638404244464850525456seats100150200250distance1route_count
BQK
76seats238distance1route_count
BQN
200seats1,576distance1route_count
BRO
6080100120140seats308distance1route_count
BTR
20406080100120140160180seats2004006008001,0001,200distance1route_count
BTV
20406080100120140160180200seats200300400500600700800distance1route_count
BUF
20406080100120140160180200seats05001,0001,5002,000distance