0

I am working on Radar sensor. I plot the data every time I get it from the sensor. I want to annotate each point with its characteristics e.g x.y.z. How can I do it?

I know about ax.annotate but I can do 1 point at one time. If I loop this command it slows my program. This is what I'm trying to accomplish:

radarSensor

vestland
  • 55,229
  • 37
  • 187
  • 305
TonyParker
  • 2,024
  • 5
  • 18
  • 27
  • Have you add a look at http://stackoverflow.com/questions/5147112/matplotlib-how-to-put-individual-tags-for-a-scatter-plot ? – P. Camilleri Sep 02 '15 at 15:38
  • @M.Massias I think the OP tried that and it slows his process down too much. – Schorsch Sep 02 '15 at 19:44
  • I cannot follow the link to your example - could you host the image somewhere else? – Schorsch Sep 02 '15 at 19:44
  • I changed the settings now it shoudl open. My reputation is less than 10 that#s why I can not post here. https://drive.google.com/file/d/0B0aeNkg1mElyUEU4M2ZSUktlSjA/view?usp=sharing – TonyParker Sep 03 '15 at 08:37

1 Answers1

1

I got the answer of my own question.

We need to use .set_text() command in a loop which updates the text(characteristics of points). Here is the abstract code:

fig1=plt.figure(figsize=(15,32))
ax1=fig1.add_subplot(111, aspect='equal')
ax1.grid(True)
Ln, = ax1.plot(plot_x,plot_y,'ro') #plot_X,plot_y are lists of points
plt.ion()                          # to make figure interactive
plt.show()
......
......
......
 Ln.set_data(plot_x,plot_y)              #to updates points in the lists
 for i in range(len(plot_ann)):    #each time plot_ann number will change
     if i >= len(ann_objs):        #ann_objs is annotation object list
        ann_objs.append(ax1.annotate("", xy=(0,0)))
        ann_objs[i].set_text(plot_ann[i])
        ann_objs[i].xy = (plot_x[i], plot_y[i])
        ann_objs[i].xyann = (plot_x[i]+0.2, plot_y[i]+0.2)
TonyParker
  • 2,024
  • 5
  • 18
  • 27