2

I would like to make a scatter graph using matplot lib of one line where the points are coloured according to a third value. I need to add a legend to explain what the colours mean. For example a white point means '0' and a red point means '5'. This seems like a really obvious thing to do but I cannot find any information anywhere online about how to do it.

TomJ_BPP
  • 21
  • 1
  • 1
    See: [https://stackoverflow.com/a/6065493/11743318](https://stackoverflow.com/a/6065493/11743318) for a scatter plot with a colorbar – compuphys Mar 31 '20 at 15:04
  • Thanks for your answer, I was aware of colorbar before but it isn't suitable here because the categories are discrete. – TomJ_BPP Apr 02 '20 at 11:32
  • This might help: [https://matplotlib.org/3.2.1/tutorials/colors/colorbar_only.html#discrete-intervals-colorbar](https://matplotlib.org/3.2.1/tutorials/colors/colorbar_only.html#discrete-intervals-colorbar) – compuphys Apr 02 '20 at 12:42

0 Answers0