Skip to content Skip to sidebar Skip to footer

Scatter Plot Of 2 Variables With Colorbar Based On Third Variable

I am trying to plot with variable x with respect to another y and add a colormap based on the values of another variable z So the plot should be similar to this My try import nump

Solution 1:

How about this (use c=df.C in the scatter command):

points = plt.scatter(df.A, df.B, c=df.C,cmap="jet", lw=0)
plt.colorbar(points)

enter image description here

Post a Comment for "Scatter Plot Of 2 Variables With Colorbar Based On Third Variable"