This is a library for creating cartographs.
Project description
carto-flow
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.
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:
- Tutorials — step-by-step guides for each cartogram type
- How-to guides — task-focused recipes
- Reference — full API reference
- Explanations — background on algorithms and design
License
See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2076dac5888a318afc7b9248b786e5206765cc46948a150d0c70c59f8c3ce631
|
|
| MD5 |
e4313d4f0f964d3d0263e94487db8870
|
|
| BLAKE2b-256 |
7440b2e70bd84b9cb57c3a57acdf913e959e263218f1203ce74b16a2ee9c6352
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82ac8802c6362e7320929cb10b7251a68331edb79ba3d3f58e0a33008a27104b
|
|
| MD5 |
1c9eef4b53516e3a646f63f67fc9ee61
|
|
| BLAKE2b-256 |
90ede7a88ae747aee6bb08f724862727c99b66f7010c43d743c8d259b0421cea
|