Skip to content Skip to sidebar Skip to footer

Matplotlib Color Gradient Based On Y-value

I would like to plot a 'cut' through a heat map, i.e. apply a color gradient to my plt.plot(x,y) based on the y-values (which are in a range of -0.5,0.5. Any suggestions? I tried t

Solution 1:

Turns out i needed to normalize my colormap by using

norm = colors.Normalize(vmin=-min, vmax=max)

and then call plt.scatter(x, y, c=y, norm=norm, …).

Post a Comment for "Matplotlib Color Gradient Based On Y-value"