bivario
Python library for plotting bivariate choropleth maps in Matplotlib, Folium and Lonboard.
Installation
With pip:
pip install bivario
With uv:
uv add bivario
Usage
Example of a Folium map in light and dark modes.
Simple Folium map:
from bivario import explore_bivariate_data
from bivario.example_data import nyc_bike_trips
explore_bivariate_data(
nyc_bike_trips(), "morning_starts", "morning_ends"
)
Simple Lonboard map:
from bivario import viz_bivariate_data
from bivario.example_data import nyc_bike_trips
viz_bivariate_data(
nyc_bike_trips(), "morning_starts", "morning_ends"
)
In dark mode:
from bivario import explore_bivariate_data
from bivario.example_data import nyc_bike_trips
explore_bivariate_data(
nyc_bike_trips(),
column_a="morning_starts",
column_b="morning_ends",
dark_mode=True, # default is False
)
Use other palette:
from bivario import explore_bivariate_data
from bivario.example_data import nyc_bike_trips
explore_bivariate_data(
nyc_bike_trips(),
column_a="morning_starts",
column_b="morning_ends",
cmap="bubblegum"
)
Set numerical mode (disable bucketing):
from bivario import explore_bivariate_data
from bivario.example_data import nyc_bike_trips
explore_bivariate_data(
nyc_bike_trips(),
column_a="morning_starts",
column_b="morning_ends",
dark_mode=True,
cmap="late_sunset",
scheme=False, # or set to None
legend_size_px=300,
)
Example of a Folium map in a numerical mode.
Bivariate colourmaps
Palettes in bivario are created by blending 2 or 4 colours in a 2D space using OKLab colour space. The operations on input and output are done in RGB, an internally are transformed into OKLab values using colour-science library.
bivario has 4 modes of Bivariate colourmaps:
AccentsBivariateColourmap - defined by two accent colours and a light and a dark colour.
CornersBivariateColourmap - defined by 4 corner colours (accent a/b, low value and high value)
MplCmapBivariateColourmap - defined by 2 Matplotlib colourmaps along axis X and Y
NamedBivariateColourmap - can load predefined palette from string name
Available palettes
You can load these palettes by passing a string name to the cmap attribute, or load a NamedBivariateColourmap object:
cmap = NamedBivariateColourmap("coral_ocean")
# You can call it similar to Matplotlib Colormap object
rgb_values = cmap(values_a=[0, 1], values_b=[0, 1])
Metadata
Release files for bivario 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bivario-0.3.1.tar.gz | 97.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bivario-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 198.5 kB
Release files / bivario-0.3.1.tar.gz
| Download URL | bivario-0.3.1.tar.gz |
|---|---|
| Size | 97.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
802271b26563d35044534fb698f59dc3a07ff5fa4d1f2971b5195013f10b079b
|
|
BLAKE2b-256 checksum How to use checksums |
5b6405544ab9bbc9d2a6a12c4f162a7a30355f5b8a61274ef49a5af28387d5df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|
Release files / bivario-0.3.1-py3-none-any.whl
| Download URL | bivario-0.3.1-py3-none-any.whl |
|---|---|
| Size | 101.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
967ce1c63e539eed44bb2853d01a9d3061be95175573a3219e314720602839db
|
|
BLAKE2b-256 checksum How to use checksums |
393f2284243ee9a2ebca8103620e42e41986dd1341baee7a6484b2492629e8a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.7
|