Skip to content

Parallel Coordinates ​

Compare multiple neighborhood attributes simultaneously with ak.ParallelCoordinates and brush axes to filter the map.

Python Script ​

python
"""Parallel coordinates + map — brush an axis to highlight the neighborhoods in that range (gallery: parallel-coordinates)."""
from __future__ import annotations

from pathlib import Path

import pyautark as ak

DATA_DIR = Path(__file__).resolve().parents[1] / "data"

neighborhoods = ak.GeoJSON(
    "neighborhoods",
    url=(DATA_DIR / "mnt_neighs_proj.geojson").as_uri(),
    coordinate_format="EPSG:3395",
)
brush = ak.interval("brush")

spec = ak.Spec(
    metadata=ak.Metadata(title="Parallel Coordinates"),
    data=[neighborhoods],
    views=[
        ak.Map(layers=[ak.Layer(neighborhoods, id="neighborhoods").style(color="#9ecae9")]),
        ak.ParallelCoordinates(
            neighborhoods,
            ["shape_area", "shape_leng", "cdta2020"],
            selection=brush,
            title="Neighborhood characteristics",
            width=760,
        ),
    ],
    links=[ak.Link(brush, target="neighborhoods")],
    layout=ak.Layout(type="vertical"),
)

if __name__ == "__main__":
    spec.window(height="760px")

Run in Jupyter or standalone HTML

Replace spec.window(...) with spec.widget() inside a Jupyter notebook (requires pip install "pyautark[widget]") or spec.save_html("out.html") to export a standalone web page.

This example comes from the pyautark repository.

Released under the MIT License.