-1

So I want to plot a Matplotlib plot x versus y, but now at certain x points I want to add a dot or a small circle with another value z written beside it.

Basically the curve depends on 3 variables and I want to plot it with 2 variables but at certain points I want to add a circle or a dot telling us about the z at that point. Also, note there will be multiple plots, thus the z circle or dot has to be of the same colour.

How can I do this?

DuttaA
  • 903
  • 4
  • 10
  • 24

1 Answers1

3

For the labelling, you can use matplotlib.pyplot.annotate("text", (x, y) ) to annotate a specific point (x,y) with text.

Please check out this resource for definition & examples: https://matplotlib.org/api/_as_gen/matplotlib.pyplot.annotate.html#examples-using-matplotlib-pyplot-annotate

To mark certain points, you need to use the markevery argument in matplotlib.pyplot.plot(). You can also customize the look of the marker with the marker argument.

Please check out this excellent answer for more info: How to mark specific data points in matplotlib graph

I hope all of this was helpful!

Zaya
  • 508
  • 4
  • 8