Skip to main content

This is a library for creating cartographs.

Project description

carto-flow

Release Build Status codecov Commit Activity License

A Python library for creating cartograms from geographic data.

Overview

carto-flow transforms geographic vector data into cartograms — maps where region sizes or symbols are scaled to represent a data variable such as population, GDP, or election results. It supports three cartogram styles:

  • Flow cartograms — regions are continuously deformed so their areas are proportional to a variable, while preserving shape and topology as much as possible (diffusion-based algorithm).
  • Symbol cartograms — regions are replaced by proportional symbols (circles, squares, hexagons, or custom isohedral tiles) arranged using physics-based or grid-based layout.
  • Proportional cartograms — region polygons are split or shrunk to show sub-group proportions within each geographic unit.

Cartogram Gallery

Features

  • Diffusion-based flow cartogram morphing with FFT-accelerated Poisson solver
  • Multi-resolution processing for large datasets
  • Physics-based symbol placement with overlap resolution and topology preservation
  • Isohedral tile support for custom symbol shapes
  • Split and shrink operations for proportional cartograms
  • Dot density cartogram support
  • Rich visualization utilities built on matplotlib and geopandas

Installation

pip install carto-flow

Or with uv:

uv add carto-flow

Requires Python 3.10+.

Quick example

import geopandas as gpd
from carto_flow.flow_cartogram import morph_gdf

gdf = gpd.read_file("countries.gpkg")
result = morph_gdf(gdf, values=gdf["population"])
result.cartogram_gdf.plot()
from carto_flow.symbol_cartogram import create_symbol_cartogram

layout = create_symbol_cartogram(gdf, values=gdf["population"])
layout.plot()

Documentation

Full documentation is available at https://bright-fakl.github.io/carto-flow/, including:

License

See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

carto_flow-1.1.2.tar.gz (11.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

carto_flow-1.1.2-py3-none-any.whl (540.8 kB view details)

Uploaded Python 3

File details

Details for the file carto_flow-1.1.2.tar.gz.

File metadata

  • Download URL: carto_flow-1.1.2.tar.gz
  • Upload date:
  • Size: 11.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for carto_flow-1.1.2.tar.gz
Algorithm Hash digest
SHA256 2076dac5888a318afc7b9248b786e5206765cc46948a150d0c70c59f8c3ce631
MD5 e4313d4f0f964d3d0263e94487db8870
BLAKE2b-256 7440b2e70bd84b9cb57c3a57acdf913e959e263218f1203ce74b16a2ee9c6352

See more details on using hashes here.

File details

Details for the file carto_flow-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: carto_flow-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 540.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for carto_flow-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 82ac8802c6362e7320929cb10b7251a68331edb79ba3d3f58e0a33008a27104b
MD5 1c9eef4b53516e3a646f63f67fc9ee61
BLAKE2b-256 90ede7a88ae747aee6bb08f724862727c99b66f7010c43d743c8d259b0421cea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page