mplcyberpunk
A Python package on top of matplotlib to create 'cyberpunk' style plots with 3 additional lines of code.
Installation
pip install mplcyberpunk
Usage
After importing the package, the cyberpunk stylesheet (dark background etc.) is available via plt.style.use.
The line glow and 'underglow' effects are added via calling add_glow_effects:
import matplotlib.pyplot as plt
import mplcyberpunk
plt.style.use("cyberpunk")
plt.plot([1, 3, 9, 5, 2, 1, 1], marker='o')
plt.plot([4, 5, 5, 7, 9, 8, 6], marker='o')
mplcyberpunk.add_glow_effects()
plt.show()
Result:
This effect is currently only implemented for lines.
The individual steps are described here in more detail.
Add effects individually
Instead of add_glow_effects, you can add the line glow and underglow effects separately:
mplcyberpunk.make_lines_glow()
mplcyberpunk.add_underglow()
You can also add the effect to a specific axis object explicitly:
fig, ax = plt.subplots()
...
mplcyberpunk.make_lines_glow(ax)
To activate the glow effect only for specific lines, pass a Line2D object or a list of Line2Ds to make_lines_glow.
Gradient glow
Gradient underglow effect can be added with
mplcyberpunk.add_glow_effects(gradient_fill=True)
or independently of line glow with
mplcyberpunk.add_gradient_fill(alpha_gradientglow=0.5)
add_gradient_fill takes a gradient_start argument for different gradient starting values:
Different glow configurations:
Scatter plots
Glow effect can be added to scatter plots via mplcyberpunk.make_scatter_glow():
Colormap
The default colormap is cool:
Others:
Bar charts
import matplotlib.pyplot as plt
import mplcyberpunk
plt.style.use('cyberpunk')
categories = ['A', 'B', 'C', 'D', 'E']
values = [25, 67, 19, 45, 10]
colors = ["C0", "C1", "C2", "C3", "C4"]
bars = plt.bar(categories, values, color=colors, zorder=2)
mplcyberpunk.add_bar_gradient(bars=bars)
plt.show()
Gallery
Some images can be bought as posters here.
Release files for mplcyberpunk 0.7.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mplcyberpunk-0.7.6.tar.gz | 1.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mplcyberpunk-0.7.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.6 MB
Release files / mplcyberpunk-0.7.6.tar.gz
| Download URL | mplcyberpunk-0.7.6.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
797cb36b5e1e178e7a3da5f4f215e469ef13935fd8c99d1cd20112e90bba7e22
|
|
BLAKE2b-256 checksum How to use checksums |
21539cf3da89c28374b92a2cb9b975fd1031858e0eaee31edd762e3a4619ecb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 26, 2025.
Transparency logRelease files / mplcyberpunk-0.7.6-py3-none-any.whl
| Download URL | mplcyberpunk-0.7.6-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5884f7add690a418695ef2f598257fedef89758c17884448518a307470590b42
|
|
BLAKE2b-256 checksum How to use checksums |
138f14ede5882332b013db2479f32b0678ff4bf4f648c5e8bce20b9f97d646bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 26, 2025.
Transparency log