Matlab 2D line plot?
3 次查看(过去 30 天)
显示 更早的评论
Hi all,
I am plotting a 2D plot using command
plot(X,Y,'-mo',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',4)
Where X and Y are the array of discreate points. The line joining top point A to point M is expected .later the line from M go directly on point Y depending on the Y height I guess, but I dont want this . I want to see the joining line as A.....G... M-N-O-P-Q.....Y..... as a sequence.
Thanks in advance.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/659560/image.jpeg)
3 个评论
KSSV
2021-6-21
Reubel Ahmed commented:
These data point is not constant and not consistent as a different programm generate the data with different time step.
回答(1 个)
Walter Roberson
2021-6-21
[SX, idx] = sort(X);
SY = Y(idx);
plot(SX, SY,'-mo',...
'LineWidth',2,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[.49 1 .63],...
'MarkerSize',4)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Line Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!