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

Using colormaps with plot() function #25

Open
besthedgehog opened this issue Mar 26, 2023 · 1 comment
Open

Using colormaps with plot() function #25

besthedgehog opened this issue Mar 26, 2023 · 1 comment

Comments

@besthedgehog
Copy link

I'm a real fan of this library but I still cannot understand how to use colormaps (cool, spring, winter, tab20, coolwarm) when I use a plt.plot() function. I want to plot a continuous line like in your examples, that's why I need to use matplotlib.pyplot.plot() function, but the problem is that you cannot pass cmap parameter to plot().
I tried to set a default colormap but couldn't reach it.
I tried to do like this, but it didn't work

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

plt.style.use("cyberpunk")

plt.rcParams['image.cmap'] = 'winter'

x = np.linspace(-5, 5, 100)
y = np.sin(x)

plt.plot(x, y)

mplcyberpunk.add_glow_effects()
plt.show()
`
Please, could you write a code to plot a simple continuous function using a colormap?

@darkmatter2222
Copy link

Something I did:
mplcyberpunk.cyberpunk_stylesheets['cyberpunk']['axes.prop_cycle'] = cycler('color', ['#08F7FE', '#FE53BB', '#F5D300', '#00ff41', 'r', '#fe00fe', '#FF5733'])
example here: https://github.com/darkmatter2222/Kaggle_Tabular_Playground_Series-ML/blob/main/Jan-2023-S4/pipelines/Blending_ROC-AUC.ipynb

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