Gradient fills for Matplotlib charts using Agg filters
Project description
mpl-gradients
A lightweight, zero-dependency library to add linear gradient fills to Matplotlib charts. Solves matplotlib/matplotlib#30958.
Features
- Vertical Gradients: Fade from Top to Bottom.
- Horizontal Gradients: Fade from Left to Right.
- Diagonal Gradients: Fade from Corner to Corner.
- Alpha Blending: Correctly handles transparency.
Installation
You can install directly from GitHub:
pip install git+[https://github.com/sanrishi/mpl-gradients.git](https://github.com/sanrishi/mpl-gradients.git)
## Quick start
import matplotlib.pyplot as plt
from mpl_gradients import LinearGradient
fig, ax = plt.subplots()
ax.bar([0, 1, 2], [10, 20, 15])
# Create a gradient (Top-Left Navy -> Bottom-Right Lime)
gradient = LinearGradient("navy", "lime", direction="diagonal")
# Apply to bars
for bar in ax.containers[0]:
bar.set_agg_filter(gradient)
plt.show()
## Requirements
Python 3.9+
Matplotlib
Numpy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mpl_gradients-0.1.0.tar.gz
(2.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mpl_gradients-0.1.0.tar.gz.
File metadata
- Download URL: mpl_gradients-0.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e8088982fb8d98a841a206dbaca4971693e13648406e38834a9b9f93c54fe95
|
|
| MD5 |
6c6eb0496634fd51d1c58c31c97e1589
|
|
| BLAKE2b-256 |
d624822db3aa8eb6d1d15276ff4b8972411c184575cffc9f5f3c7bf0726baa75
|
File details
Details for the file mpl_gradients-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mpl_gradients-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df034ba28048035ab1c57c56d8eec72ef9dad68c5ce1add9a38b9786f4811e9b
|
|
| MD5 |
d12577223fa3f359034c56850f229482
|
|
| BLAKE2b-256 |
b9b261360cf929d7efb7dabdceec9b7f4ced35f3956565c827a0959c9ad756a1
|