I have a dataframe that looks like this:
x | y | value
10 20 0.1
20 5 0.2
30 15 0.7
40 10 0.5
I want to plot these values in a scatter plot and the color of each marker should be a color map calculated from the value
column. The values go from 0 to 1.
Should I create a custom color map? How do I use it then?
EDIT:
Since some of the rows are not relevant to the scatter plot, I am plotting the relevant rows by iterating through the dataset:
for i,row in df.iterrows():
ax.scatter(df.iloc[i]['y'], df.iloc[i]['x'], c= row['value'] , cmap='jet', edgecolors = 'r', linewidths = '1', marker='p', s=80)
Thank you! Kind Regards
plt.scatter(df['x'], df['y'], c=df['value'], cmap='inferno')
? – JohanCIndexError: tuple index out of range
– Luís Costaplt.scatter(df['x'][ind], df['y'][ind], c=df['value'][ind], cmap='inferno')
. Also, it is strongly recommended not to usejet
if you want to avoid strange highlights. – JohanC