2

I would like to make a 2D scatter plot (x,y) and the color of the point is value (from 0 and 1) with a heatmap legend, using the following dataset:

x y value
3 2 0.1
2 1 0.2
...

I checked both Plotting a 2D heatmap with Matplotlib and Make a 2D pixel plot with matplotlib but none of them supports what I am looking for.

xdze2
  • 3,986
  • 2
  • 12
  • 29
mommomonthewind
  • 4,390
  • 11
  • 46
  • 74
  • What is your input format? A csv file? A pandas dataframe? A list of lists? And a heatmap legend requires somewhat a heatmap, which you don't produce with `plt.scatter(x, y, c = value)`. Are you looking for `plt.colorbar()`? – Mr. T Aug 01 '18 at 07:43

1 Answers1

4

This is no problem:

plt.scatter(x=x, y=y, c=value)

c stands for color/colormap.

Andreas Look
  • 151
  • 4