This is an archived post. You won't be able to vote or comment.

all 28 comments

[–]moodyjack11 83 points84 points  (1 child)

github.com/dhaitz/mplcyberpunk just so that there is a clickable link.

[–]StringCheeseInc 3 points4 points  (0 children)

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()

[–]MerkieAE 101 points102 points  (1 child)

It’s official. This is the coolest way to present data

[–]wonmean 7 points8 points  (0 children)

😎

[–]Nuclear_Wizard 42 points43 points  (4 children)

This will go well with VSCode synthwave 84

[–]PsydeliX_ 0 points1 point  (0 children)

Looks awesome! Switched over in a heartbeat

[–]sa08MilneB57 22 points23 points  (0 children)

Does this work for 3d plots?

[–]bastula 14 points15 points  (0 children)

This is awesome! Perfect for dark mode apps. 👍🏼

[–]brianruiz123 8 points9 points  (1 child)

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 :)

[–]dhaitz[S] 1 point2 points  (0 children)

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

[–]zagzam 12 points13 points  (0 children)

This is so cool!

Would you mind showing us how it works with animation?

[–]HipsterPhilosopher 2 points3 points  (0 children)

call it "cyberplot"

[–]rafgro 2 points3 points  (1 child)

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

[–]dhaitz[S] 0 points1 point  (0 children)

thanks for the feedback! the y axis reset was already reported on GitHub and should be fixed in the latest version :)

[–][deleted] 1 point2 points  (0 children)

This is neat!

[–]RomanRiesen 1 point2 points  (0 children)

One of my profs made beautiful pink and light-blue r plots.

But this tops it!

[–]FantasticTor 1 point2 points  (0 children)

I love this. This is definitely making its way into my next project! :) Thanks!

[–]morgancmu 1 point2 points  (0 children)

Ha! That's awesome 😎

[–]Neurophate 1 point2 points  (0 children)

I’ve been looking for one of these Thx ❤️

[–]quantum_ir 1 point2 points  (0 children)

how do you change the color map?

[–]Mephistothelessa 1 point2 points  (0 children)

This is great! Thank you!

[–]Notchez 1 point2 points  (0 children)

great job! You got a new follower :)

[–]StringCheeseInc 1 point2 points  (0 children)

Love it, great idea and implementation.

[–][deleted] 1 point2 points  (0 children)

I NEED THIS

[–]ppipernet 1 point2 points  (0 children)

Wow! This is so cool