add data points to a graph

254 次查看(过去 30 天)
maryam
maryam 2013-9-25
回答: Harsh 2021-10-18
hi i have a matlab figure, and i'd like to highlight some important points on it, could anybody help me? tnx in advance

采纳的回答

David Sanchez
David Sanchez 2013-9-25
Select the "Data Cursor" on the figure window and click on the point you want.
Hold "alt" to multiple selection.

更多回答(2 个)

Youssef  Khmou
Youssef Khmou 2013-9-25
编辑:Youssef Khmou 2013-9-25
you have to know the xy coordinates of those points to mark them . suppose i have a graph Y(X) :
X=1:10;Y=randn(1,10);
plot(X,Y), hold on,
Marked=[X(2) Y(2); X(4) Y(4)];
plot(Marked(:,1),Marked(:,2),'o');
  1 个评论
maryam
maryam 2013-9-26
tnx for ur answer,but i dont know the xy coordinates,just a figure.

请先登录,再进行评论。


Harsh
Harsh 2021-10-18
folowing is an example where i have highlited a point with red airstrike
function m = plot_cos(y, t)
plot(t,y,'b--')
hold on
[iminy,idy]=min(y);
plot(idy,iminy,'r*')
hold off
m=min(y);
end

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by