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 force-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
- Force-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
Changelog
CHANGELOG.md lists the changes in each release. Upgrading from 1.x requires code changes in the symbol cartogram API; the migration guide gives the old and new form of every affected call.
License
See LICENSE.
Metadata
Release files for carto-flow 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| carto_flow-2.0.0.tar.gz | 3.7 MB | Without provenance | Details for carto_flow-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| carto_flow-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for carto_flow-2.0.0-py3-none-any.whl |
Total release size: 6.7 MB
Release files / carto_flow-2.0.0.tar.gz
| Download URL | carto_flow-2.0.0.tar.gz |
|---|---|
| Size | 3.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6bca1056f807952a7beacb37df08b377b8f96d5a348fa257d70cf562ed91835
|
|
BLAKE2b-256 checksum How to use checksums |
73081638ddb3862f8a687140596658d389b4a448ddc7103bebdb960ff91c01d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}
|
Release files / carto_flow-2.0.0-py3-none-any.whl
| Download URL | carto_flow-2.0.0-py3-none-any.whl |
|---|---|
| Size | 3.0 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd1a23d211518730cdc5e9ffeadf955c5dc975493fcd32566d6c9189dbf5df3f
|
|
BLAKE2b-256 checksum How to use checksums |
51c6f66c5b292bf3538a20684d7615288e33d5c20ff2798e91d4a83ae4a8db16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","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}
|
Security for carto-flow 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.