Effacer les filtres
Effacer les filtres

How can I insert data info. in plot?

9 vues (au cours des 30 derniers jours)
Abdulaziz
Abdulaziz le 23 Fév 2014
Hello every one,
Please I have question I could not figure. I have a plot of two curves and I want to show the improvement obtained by the second curve. In other words, for example if the first curve has a datum of 60 and the second one has corresponding datum of 75, that means improvement 25%. Is there any way to show this number (25%) close to this datum on the plot programatically or manually from the plot.
Thanks in advance

Réponse acceptée

Mischa Kim
Mischa Kim le 23 Fév 2014
You could simply put a text label next or close to a data point:
text(x_pos,y_pos,text_lab)
where x_pos and y_pos are the coordinates of the text box. text_lab is a string that you could put together from your measurement data (using num2str).
  2 commentaires
Abdulaziz
Abdulaziz le 27 Fév 2014
Thank you Mischa, That exactly what i want, however the data are overlapping because I have 4 curves. I just illustrate one data from each ten. Is there any way to have these data in a box like the legend but close to the data, also can I insert % symbol to this function. I am sending you a photo of the curve. The function I wrot is: text(U_R(1:10:end,i+1),R(1:10:end),num2str(U_percent(1:10:end,i+1)));
Abdulaziz
Abdulaziz le 27 Fév 2014

Connectez-vous pour commenter.

Plus de réponses (1)

Chandru Muthusamy
Chandru Muthusamy le 17 Déc 2019
Hi
I try to label my points. I just modified Abdulaziz code for my 3-D plot. But it is not working to me! Here, the labeling string(number) vary everytime when I run the code. Can any body help me!
The modified code is given below. text(X(1:end,i+1),Y(1:end),Z(1:end),num2str(N_chain(1:end,i+1)));
Attachment:
  1. Non_Labeled - It just provided to view the clear graph.
  2. Labeled - It is the out that I am getting for above code. It means entire set of labels(strings) are appearing at the same time in each node. I need to display it separately to understand position.
Can anybody help me to get the same

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by