How to change color (direction) of a ridgeline joyplot chart?

96 Views Asked by At

I have a df that looks like this: enter image description here

cmap = plt.cm.get_cmap('RdYlGn')

fig, ax=joyplot(df.T,
    colormap=cmap,
    fade=True,
    grid=True,
    alpha=0.75,
    linecolor='white',
    linewidth=0.25,
    )

the code above results in this chart:

enter image description here

I need the coloring changed from left to right, i.e. form low to high values along the x-axis in the chart, as shown in this chart (borrowed from twitter):

enter image description here

Any suggestions? I've tried ChatGPT but it wasn't able to solve it...

I have tried something like this, but it results in single color only:

#norm = plt.Normalize(vmin=1, vmax=15)
#colors = cmap(norm(df.T))

and then change: colormap=cmap to colormap=colors in joyplot.. but it's not working.

thanks in advance :)

0

There are 0 best solutions below