Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to turn on the grid? #24

Closed
LukaPitamic opened this issue Jan 6, 2023 · 6 comments
Closed

how to turn on the grid? #24

LukaPitamic opened this issue Jan 6, 2023 · 6 comments

Comments

@LukaPitamic
Copy link

First and foremost - AWESOME project.
Working in data-analysis world I'm always missing some aesthetics to spice up the work.

However I'm trying to get closer to examples displayed on readme.md and I can't find any elegant way to show the grid. I can add it manually of course but the examples are so well balanced I wish I could achieve the same. Also what size and DPI were used for achieving this beauty?
And again, thank you for taking care of something missing in this world ;).

@dhaitz
Copy link
Owner

dhaitz commented Jan 7, 2023

Hi @LukaPitamic, thanks for the kind words! As mplcyberpunk is only a decorative layer, you can refer to the matplotlib docs for most options. See e.g. here for grid options. Does this answer your question?

@LukaPitamic
Copy link
Author

Hi @dhaitz,
thank you quick response. I'm aware of the matplotlib grid options, I already started to "reverse engineer" the look from examples. I'm kind of struggling to get the same look though. If you don't mind sharing the exact matplotlib object buildup (with all settings/parameters) - it would be super appreciated. But if you don't have it handy, please don't bother, I'll do my homework.
In any case, great work!

@dhaitz
Copy link
Owner

dhaitz commented Jan 8, 2023

hi @LukaPitamic, which specific example from the README are you referring to?

@LukaPitamic
Copy link
Author

...any example with visible grid would do, but if I have to pick one, then:

colormap

I'm after the visual balance between grid and axis. It's a combination of plot size (and DPI setting) and grid & axis lines width.
Thanks!

@dhaitz
Copy link
Owner

dhaitz commented Jan 8, 2023

Here you go:

import numpy as np
import matplotlib.pyplot as plt
import mplcyberpunk

plt.style.use("cyberpunk")
plt.rcParams['figure.dpi'] = 100

x = np.linspace(0, 2*np.pi, 128)

n = 20
colors = plt.cm.cool(np.linspace(0,1,n))

for i in range(n): 
    y = np.cos(x) * (i-(n-1)/2)
    plt.plot(x, y, color=colors[i])

mplcyberpunk.make_lines_glow()
plt.show()

Please let me know if this is sufficient.

@LukaPitamic
Copy link
Author

AMAZING!!!

@dhaitz, thank you very, very much.
From now on the world observed through data also looks great!

@dhaitz dhaitz closed this as completed Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants