Why does plot(X,Y,'or') and plot(X,Y) give different results
Ältere Kommentare anzeigen
So,I have a set of points that I am trying to visualize.
The points are obtained by running the code mentioned in the below link
Basically the output of this is a structure that stores the positions of the edges along with some other stuff.
Now,when I plot edges.x and edges.y using the following command
plot(edges.x,edges.y,'or'); The result comes out like this

Whereas the result of plot(edges.x,edges.y) is like this

The original result of the code is as follows

Any idea why the line plot is coming out like this,and what can be done to correct it.
Note 1 : After inspecting the picture,I was able to visually figure out the correct order.If you look at edges.mat the expected starting point is [103,66.3015] and the same is the end point
Akzeptierte Antwort
Weitere Antworten (2)
Chunru
am 12 Aug. 2021
0 Stimmen
The line plot draws line from one point to another point. The order of points is thus important. The 'or' option just plots the data points without draw line.
If the data points were in right order, you could have seen a line plot more similar to the scatter plot ('ro').
KSSV
am 12 Aug. 2021
0 Stimmen
When you plot with markers (i.e. 'o'), plot will not connect the markers. But when you simply plot, it will try to join them by lines. Your points are not in order, so they are joined as the points are given.
Attach your points to get what you want.
1 Kommentar
Sparsh Garg
am 12 Aug. 2021
Kategorien
Mehr zu Annotations finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




