Add-on for Matplotlib to produce 'Cyberpunk' style plots
Project description
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.
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
Built Distribution
File details
Details for the file mplcyberpunk-0.7.6.tar.gz
.
File metadata
- Download URL: mplcyberpunk-0.7.6.tar.gz
- Upload date:
- Size: 1.6 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
797cb36b5e1e178e7a3da5f4f215e469ef13935fd8c99d1cd20112e90bba7e22
|
|
MD5 |
262ab7e7331028f8d0c5379caf151ec1
|
|
BLAKE2b-256 |
21539cf3da89c28374b92a2cb9b975fd1031858e0eaee31edd762e3a4619ecb7
|
Provenance
The following attestation bundles were made for mplcyberpunk-0.7.6.tar.gz
:
Publisher:
test-deploy.yml
on dhaitz/mplcyberpunk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
mplcyberpunk-0.7.6.tar.gz
-
Subject digest:
797cb36b5e1e178e7a3da5f4f215e469ef13935fd8c99d1cd20112e90bba7e22
- Sigstore transparency entry: 174570093
- Sigstore integration time:
-
Permalink:
dhaitz/mplcyberpunk@f873d0fa7caf1ad6afd650d848eb40f70bac75f2
-
Branch / Tag:
refs/tags/v0.7.6
- Owner: https://github.com/dhaitz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
test-deploy.yml@f873d0fa7caf1ad6afd650d848eb40f70bac75f2
-
Trigger Event:
push
-
Statement type:
File details
Details for the file mplcyberpunk-0.7.6-py3-none-any.whl
.
File metadata
- Download URL: mplcyberpunk-0.7.6-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
5884f7add690a418695ef2f598257fedef89758c17884448518a307470590b42
|
|
MD5 |
2af42717edfd31366375963060746d5c
|
|
BLAKE2b-256 |
138f14ede5882332b013db2479f32b0678ff4bf4f648c5e8bce20b9f97d646bc
|
Provenance
The following attestation bundles were made for mplcyberpunk-0.7.6-py3-none-any.whl
:
Publisher:
test-deploy.yml
on dhaitz/mplcyberpunk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
mplcyberpunk-0.7.6-py3-none-any.whl
-
Subject digest:
5884f7add690a418695ef2f598257fedef89758c17884448518a307470590b42
- Sigstore transparency entry: 174570098
- Sigstore integration time:
-
Permalink:
dhaitz/mplcyberpunk@f873d0fa7caf1ad6afd650d848eb40f70bac75f2
-
Branch / Tag:
refs/tags/v0.7.6
- Owner: https://github.com/dhaitz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
test-deploy.yml@f873d0fa7caf1ad6afd650d848eb40f70bac75f2
-
Trigger Event:
push
-
Statement type: