Plot markers as a continuous line
75 ビュー (過去 30 日間)
古いコメントを表示
Hi there, I am trying to plot lots of points representing a seismic fault over some topography. I am plotting the data in the form plot(x,y,'.') but as the data represnets a shape I need the gaps between each of the points filling so it looks like a smooth line.
plotting in the form plot(x,y'-') is very messy.
Any ides on how to fix this?
4 件のコメント
Adam
2019 年 2 月 28 日
編集済み: Adam
2019 年 2 月 28 日
And do you have an example of the points? I know you can get a mess sometimes with line plots, but only usually if the points are in a jumbled order. If they are in the order you want them to be joined they should normally be joined as you would expect them. Are your points sorted in y? I assume if it is a seismic fault that y-values should be monotonically increasing?
回答 (2 件)
Kevin Phung
2019 年 2 月 28 日
編集済み: Kevin Phung
2019 年 2 月 28 日
try this :
[new_x, ord] = sort(x);
new_y = y(ord);
plot(new_x,new_y,'r-')
let me know if this helped
4 件のコメント
Walter Roberson
2019 年 3 月 2 日
You posted a question about splitting your data; I have responded to it a second ago.
Image Analyst
2019 年 3 月 2 日
Don't use the dash line specifier because it looks like you might be plotting one 2-D array and the ends of one line are connecting to the beginning of the next line.
Just use dot and the MarkerSize property and see if that works for you.
plot(x, y, 'b.', 'MarkerSize', 10);
Adjust color and MarkerSize as needed.
If it's a 2-D array you're plotting, consider plotting each row or column one at a time rather than the 2-D matrix all with one call to plot().
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!