{"id":2121,"library":"mizani","title":"Mizani","description":"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.","status":"active","version":"0.14.4","language":"en","source_language":"en","source_url":"https://github.com/has2k1/mizani","tags":["data visualization","scales","plotting","ggplot2","backend","statistics"],"install":[{"cmd":"pip install mizani","lang":"bash","label":"Latest stable release"}],"dependencies":[{"reason":"Commonly used for numerical operations, especially when working with data that requires scaling or transformations, as shown in quickstart examples.","package":"numpy","optional":true}],"imports":[{"symbol":"breaks_log","correct":"from mizani.breaks import breaks_log"},{"symbol":"rescale","correct":"from mizani.bounds import rescale"},{"symbol":"gradient_n_pal","correct":"from mizani.palettes import gradient_n_pal"}],"quickstart":{"code":"import numpy as np\nfrom mizani.breaks import breaks_log\n\n# Define a range of data, e.g., from a logarithmic distribution\nx = np.logspace(3, 6, 100) # 100 points from 10^3 to 10^6\nlimits = min(x), max(x)\n\n# Calculate logarithmic breaks for the given limits\nlog_breaks = breaks_log()(limits)\nprint(f\"Data limits: {limits}\")\nprint(f\"Calculated logarithmic breaks: {log_breaks}\")\n\n# You can also specify a base for the logarithm\nlog_breaks_base2 = breaks_log(base=2)(limits)\nprint(f\"Calculated base-2 logarithmic breaks: {log_breaks_base2}\")","lang":"python","description":"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."},"warnings":[{"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.","message":"The `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`.","severity":"gotcha","affected_versions":"All versions"},{"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.","message":"Mizani 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.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}