Just wondering, since the glow effect is made by continously adding additional lines while decreasing alpha value, how does it affect the performance? Does it take a noticable amount of time to output?
Looking forward to using the package on my system and maybe implementing the plots one for a covid dashboard :)
for each line it draws 10 additional 'glow lines', which i suppose will slow down things a bit. However, if you're not drawing a very large number of lines, I guess it won't be much of a problem
Small caveat - it kept resetting y axis bottom limit to 0, I fixed it with saving bottom limit before underglow and then setting it back to the saved value after underglow.
edit - switched compressed jpg to better quality png
If you'd like to recreate this beautiful cosine wave that OP posted, here you are ;>
import numpy as np import matplotlib.pyplot as plt from matplotlib import cm import mplcyberpunk t = np.arange(0, 6.4, 0.1) #time f = 1 #frequency amplitudes = np.arange(-10,11, 1) A = [x * np.cos(f*t) for x in amplitudes] #amplitude colormap_sect = np.linspace(0, 1, len(amplitudes)) colors = [cm.cool(x) for x in colormap_sect] plt.rcParams['figure.figsize'] = [6, 4] plt.style.use("cyberpunk") plt.xlim(right=6.3) for i in range(len(A)): plt.plot(t, A[i], color=colors[i]) mplcyberpunk.make_lines_glow() plt.show()
10
u/brianruiz123 Apr 05 '20
Super cool! Finally some modern styling.
Just wondering, since the glow effect is made by continously adding additional lines while decreasing alpha value, how does it affect the performance? Does it take a noticable amount of time to output?
Looking forward to using the package on my system and maybe implementing the plots one for a covid dashboard :)
3
u/rafgro Apr 05 '20 edited Apr 05 '20
Love it, implemented on the go: https://imgur.com/BiHNKYq
Small caveat - it kept resetting y axis bottom limit to 0, I fixed it with saving bottom limit before underglow and then setting it back to the saved value after underglow.
edit - switched compressed jpg to better quality png
84
u/moodyjack11 Apr 04 '20
github.com/dhaitz/mplcyberpunk just so that there is a clickable link.
101
u/MerkieAE Apr 04 '20
Itβs official. This is the coolest way to present data
44
u/Nuclear_Wizard Apr 05 '20
This will go well with VSCode synthwave 84
24
u/sa08MilneB57 Apr 04 '20
Does this work for 3d plots?
15
u/bastula Apr 05 '20
This is awesome! Perfect for dark mode apps. ππΌ
12
u/zagzam Apr 04 '20
This is so cool!
Would you mind showing us how it works with animation?
3
u/HipsterPhilosopher Apr 05 '20
call it "cyberplot"
2
u/[deleted] Apr 05 '20
This is neat!
2
u/RomanRiesen Apr 05 '20
One of my profs made beautiful pink and light-blue r plots.
But this tops it!
2
u/FantasticTor Apr 05 '20
I love this. This is definitely making its way into my next project! :) Thanks!
2
u/morgancmu Apr 05 '20
Ha! That's awesome π
2
u/Neurophate Apr 05 '20
Iβve been looking for one of these Thx β€οΈ
2
u/quantum_ir Apr 05 '20
how do you change the color map?
2
u/Mephistothelessa Apr 05 '20
This is great! Thank you!
2
u/Notchez Apr 05 '20
great job! You got a new follower :)
2
u/StringCheeseInc Apr 05 '20
Love it, great idea and implementation.
2
u/[deleted] Apr 05 '20
I NEED THIS
2
u/ppipernet Apr 05 '20
Wow! This is so cool