mark points on graph

~do calculations
x=ddata;
y = edata;
handles=guidata(hObject);
[X,Y] = peaks;
surf(X,Y);
xlim([-inf inf]);
ylim([0 inf]);
plot(x,y,'parent',handles.axes1);
hold on
plot(x_mark,y_mark,'c*',handles.axes1)
hold off
the x_mark and y_mark are both in array that I got from a while loop. I made a GUI that plots the figure

2 件のコメント

Jan
Jan 2018 年 1 月 22 日
hi  hey
hi hey 2018 年 1 月 22 日
How do I mark (with a dot or asteroid and different color) my (x_mark,y_mark) points on the (x,y) points on my graph?
The (x_mark,y_mark) are specific points on the (x,y) graph that I want to highlight.
The code is plotting (x,y) first and then plotting (x_mark,y_mark)

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2018 年 1 月 22 日

0 投票

Example:
x = 1:10;
y = rand(1, 10);
s = [2,4,8]; % Indices of points to mark
plot(x, y);
hold on
plot(x(s), y(s), '*')

4 件のコメント

hi  hey
hi hey 2018 年 1 月 22 日
That didn't work but I did find a few errors in my code that I fixed which solved part of my problem.
hold on
plot(x2,y2,'*')
hold off
But for some reason the points aren't on the line, they are below it. They should be on the lines because I'm picking points off of the line data.
Jan
Jan 2018 年 1 月 22 日
I cannot guess what does not work or why which points are below which line. Please post the details.
hi  hey
hi hey 2018 年 1 月 22 日
So basically I mapped coordinates on a graph. I then did a calculation to find the stopping point every 8hrs which I saved into x_mark and y_mark. I then want to have these points marked/highlighted on the graph
Jan
Jan 2018 年 1 月 22 日
@hi hey: This explanation does not help to understand "That didn't work" and why which points are shifted vertically. If you still need help, please post something, which let the readers reconsider, what's going wrong: code, input data, screenshot of the diagram, ...

サインインしてコメントする。

カテゴリ

ヘルプ センター および File Exchange2-D and 3-D Plots についてさらに検索

タグ

質問済み:

2018 年 1 月 22 日

コメント済み:

Jan
2018 年 1 月 22 日

Community Treasure Hunt

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

Start Hunting!

Translated by