2

How Can I plot some coordinates with corresponding names written with it in Python?

Suppose we have some points A(5,3) B(-3,1) C(-6,-4) D(0,-3) E(0,0) F(4,-5)

I want to plot is like this photo

enter image description here

How can I do that?

jbsu32
  • 1,036
  • 1
  • 11
  • 31

1 Answers1

6
'''
A(5,3) B(-3,1) C(-6,-4) D(0,-3) E(0,0) F(4,-5)
'''
import matplotlib.pyplot as plt

x = [5,-3,-6,0,0,4]
y = [3,1,-4,-3,0,-5]
n=['A','B','C','D','E','F']
fig, ax = plt.subplots()
ax.scatter(x, y)

for i, txt in enumerate(n):
    ax.annotate(txt, (x[i], y[i]))

plt.show()
losifar luv
  • 105
  • 3