Registry / data / aquarel

aquarel

JSON →
library0.0.7pypypi✓ verified 23d ago

Aquarel is a lightweight templating engine and wrapper around Matplotlib's rcparams designed to simplify plot styling. It enables programmatic definition and JSON serialization of themes, facilitating sharing and consistent visualization across projects. Beyond standard Matplotlib stylesheets, Aquarel introduces 'transforms' for aesthetics not achievable via rcparams alone, such as trimmed axes. The library is actively maintained with frequent minor updates.

pip install aquarel
INSTALL
IMPORT
SIG · AQUAREL
A
aquarel
datapythonv0.0.7
Install
11.8s avg
Import
3670ms
Disk
258MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.0.7 · 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 3.794s · 254.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 11.8s · import 3.546s · 243MB
258MB installed
● package 258MB
Code
Verified usage

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

load_theme
from aquarel import load_theme

This quickstart demonstrates how to apply an Aquarel theme using a context manager. The `load_theme()` function fetches a predefined theme, which is then applied within the `with` block. All plotting commands inside this block will adopt the specified theme. Remember that `plt.savefig()` or `plt.show()` should be called *outside* the context manager if transforms are used, to ensure they are correctly applied.

import matplotlib.pyplot as plt import numpy as np from aquarel import load_theme # Define a sample plotting function def create_plot(): fig, ax = plt.subplots(figsize=(8, 6)) x = np.linspace(0, 10, 100) y = np.sin(x) ax.plot(x, y, label='Sine Wave') ax.set_title('Sample Plot') ax.set_xlabel('X-axis') ax.set_ylabel('Y-axis') ax.legend() return fig # Apply a theme using a context manager with load_theme('arctic_light'): fig = create_plot() plt.savefig('arctic_light_plot.png') # In a non-script environment (e.g., Jupyter), you might call plt.show() here if needed print('Plot with arctic_light theme saved to arctic_light_plot.png')
Debug
Known issues
gotchaAquarel 'transforms' (e.g., for trimming axes) must be applied after the plot objects (figure/axes) are created. While the context manager (`with load_theme(...)`) handles this automatically on exit, if applying a theme globally (`theme.apply()`), you must manually call `theme.apply_transforms()` after all plotting commands for the effects to take place.
fix
Use the context manager (`with load_theme(...):`) for automatic transform application, or ensure `theme.apply_transforms()` is explicitly called after plot creation when applying themes globally.
affects: All versions
gotchaWhen using a theme with transforms via the context manager, ensure `plt.show()` or `fig.savefig()` is called *outside* the `with` block. This guarantees that transforms, which modify the finished figure, are correctly applied before rendering or saving.
fix
Place `plt.show()` or `fig.savefig()` after the `with load_theme(...):` block.
affects: All versions
breakingVersion 0.0.6 addressed an incompatibility with `MatplotlibDeprecationWarning`. Users on older `aquarel` versions might encounter issues or warnings with newer Matplotlib releases, or conversely, `aquarel` updates might require a specific Matplotlib version to resolve internal warnings.
fix
Upgrade to `aquarel` version 0.0.6 or newer to ensure compatibility with recent Matplotlib changes and avoid deprecation warnings.
affects: <0.0.6
gotchaUnlike standard Matplotlib stylesheets that are applied once globally for the current plotting context, Aquarel aims to provide per-plot styling with temporary changes. The style applied within an Aquarel context manager is only active inside that block and reverts outside of it, which differs from how global `plt.style.use()` typically functions.
fix
Understand that Aquarel's context manager provides scoped styling. For persistent global styling, `theme.apply()` can be used, but remember the implications for transforms.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'aquarel'
This error occurs when the 'aquarel' library is not installed in your Python environment.
fix
Install the 'aquarel' package using pip: 'pip install aquarel'.
ImportError: cannot import name 'load_theme' from 'aquarel'
This error occurs when attempting to import a function or class that does not exist in the 'aquarel' module.
fix
Ensure that 'load_theme' is a valid function in 'aquarel' and that you are using the correct import statement: 'from aquarel import load_theme'.
AttributeError: module 'aquarel' has no attribute 'Theme'
This error occurs when trying to access an attribute or class that does not exist in the 'aquarel' module.
fix
Verify that 'Theme' is a valid class in 'aquarel' and that you are using the correct import statement: 'from aquarel import Theme'.
TypeError: 'NoneType' object is not callable
This error occurs when attempting to call a function that is actually a 'None' object, possibly due to incorrect assignment or import.
fix
Check the assignment and import statements to ensure that the function or object is correctly defined and imported.
ValueError: Invalid theme name 'arctic_light'
This error occurs when specifying a theme name that does not exist in the 'aquarel' library.
fix
Ensure that the theme name is spelled correctly and exists in 'aquarel'. You can list available themes using 'aquarel.list_themes()'.
Upgrade
Version history
0.0.7latest on PyPI · released Jan 23, 2025
Audit
Dependencies
matplotlibrequiredCore dependency as Aquarel acts as a styling wrapper for Matplotlib plots.
seabornoptionalAquarel builds on top of Matplotlib and Seaborn for enhanced data visualization capabilities.
Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
1
Resources
aquarel — pip install aquarel · libregistry