Registry / data / mizani

mizani

JSON →
library0.14.4pypypi✓ verified 24d ago

Mizani is a Python library that provides a comprehensive set of 'scales' for graphics systems, mirroring the functionality of Hadley Wickham's popular R Scales package. It offers tools for data transformation, calculating aesthetically pleasing breaks for axes, and generating color palettes. The current version is 0.14.4, with releases occurring periodically, often in conjunction with Python version updates or fixes.

pip install mizani
INSTALL
IMPORT
SIG · MIZANI
M
mizani
datapythonv0.14.4
Install
11.5s avg
Import
964ms
Disk
306MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.14.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 1.020s · 307MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 11.5s · import 0.908s · 294MB
306MB installed
● package 306MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

breaks_log
from mizani.breaks import breaks_log
rescale
from mizani.bounds import rescale
gradient_n_pal
from mizani.palettes import gradient_n_pal

This quickstart demonstrates how to use `mizani.breaks.breaks_log` to calculate visually appropriate logarithmic breaks for a given data range. This is a fundamental operation for creating readable plots with logarithmic scales.

import numpy as np from mizani.breaks import breaks_log # Define a range of data, e.g., from a logarithmic distribution x = np.logspace(3, 6, 100) # 100 points from 10^3 to 10^6 limits = min(x), max(x) # Calculate logarithmic breaks for the given limits log_breaks = breaks_log()(limits) print(f"Data limits: {limits}") print(f"Calculated logarithmic breaks: {log_breaks}") # You can also specify a base for the logarithm log_breaks_base2 = breaks_log(base=2)(limits) print(f"Calculated base-2 logarithmic breaks: {log_breaks_base2}")
Debug
Known issues
gotchaThe `mizani.transforms` module, which handles time-related transformations, may raise a `ModuleNotFoundError` for `tzdata` on certain platforms (e.g., Pyodide or some Windows setups) if the system does not provide `tzdata`. This is because Python's `zoneinfo` module, used by `mizani`, relies on system `tzdata`.
fix
Users on affected platforms may need to ensure `tzdata` is available, potentially by installing the `tzdata` PyPI package if `mizani` does not explicitly list it as a dependency, or by using environments where `tzdata` is provided by default.
affects: All versions
gotchaMizani is a foundational library for constructing graphic scales, not a high-level plotting library itself. While it provides powerful components, direct usage often requires integration with a graphics system (like `plotnine`) rather than producing standalone plots directly. Users expecting immediate plot generation might find it requires more setup.
fix
For direct plotting, consider using a library that integrates Mizani, such as `plotnine`, which leverages Mizani's capabilities internally. If building a custom graphics system, refer to Mizani's documentation for integrating its scale components.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'tzdata'
The `mizani.transforms` submodule, used for datetime transformations, requires the `tzdata` package, which is not always present by default on all operating systems or Python environments (e.g., some Pyodide installations).
fix
Install the `tzdata` package: `pip install tzdata`
ModuleNotFoundError: No module named 'mizani'
The `mizani` library has not been installed in the Python environment where the code is being executed.
fix
Install the library using pip: `pip install mizani`
AttributeError: 'ScaleContinuous' object has no attribute 'some_method'
This error often occurs due to version incompatibilities between `mizani` and other libraries that depend on its API (e.g., `plotnine`). A method or attribute expected by the dependent library may have been renamed, removed, or not yet introduced in the installed version of `mizani`.
fix
Check the version requirements of any libraries using `mizani` (e.g., `plotnine`). Install a compatible version of `mizani` and its dependencies. For example, if using `plotnine`, you might need to pin specific versions like `pip install mizani==0.9.2 plotnine==0.10.1`.
Upgrade
Version history
0.14.4latest on PyPI · released Jan 28, 2026
Audit
Dependencies
numpyoptionalCommonly used for numerical operations, especially when working with data that requires scaling or transformations, as shown in quickstart examples.
Agent activity
5 hits · last 30 days
node
4
Resources
mizani — pip install mizani · libregistry