Plot markers as a continuous line

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
Adam 2019년 2월 28일
What do you want it to look like that is different from using plot(x,y,'-')? What is messy about it? Can you post an image?
P_L
P_L 2019년 2월 28일
Hi Adam, I want to plot the coordinates in my fault as a smooth line. If i plot them as points- the markers are too sparse. If I plot them using '-' they look messy like this (please see attached image) .
Many thanks! screenshot_NAFZ_lines.jpg
Adam
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?
P_L
P_L 2019년 2월 28일
Hi Adam thanks for getting back to me. They were in decending order and now i have just tried it by placing them in ascending order - but still no luck :(

댓글을 달려면 로그인하십시오.

답변 (2개)

Kevin Phung
Kevin Phung 2019년 2월 28일
편집: Kevin Phung 2019년 2월 28일

0 개 추천

try this :
[new_x, ord] = sort(x);
new_y = y(ord);
plot(new_x,new_y,'r-')
let me know if this helped

댓글 수: 4

P_L
P_L 2019년 3월 1일
Hi Kevin, nope! looks like rain now :(.
Many Thanksdde54af9-84e3-44e1-97c1-715b6b3a61ec.jpg
Kevin Phung
Kevin Phung 2019년 3월 1일
To be able to help, I think you need to provide in what order you need the data to be in, and in what order they currently are because the plot function plots each marker and draws a line through them in the order that you plot it.
Walter Roberson
Walter Roberson 2019년 3월 2일
You posted a question about splitting your data; I have responded to it a second ago.
P_L
P_L 2019년 3월 2일
Hi Walter thank you, yes i posted that comment over an hour ago. I have deleted it now as it has been resolved :)

댓글을 달려면 로그인하십시오.

Image Analyst
Image Analyst 2019년 3월 2일

0 개 추천

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().

댓글 수: 1

P_L
P_L 2019년 3월 4일
Hi there, I already tried increasing the marker size but the gaps in data points are too big. I also tried your secong suggestion which I couldn't get to work earlier. The fault data I have read in for a collection of faults which is why I believe it's behaving the way it is. I have now seperated the data into seperate vectors and and I amtrying to plot it this way.
Thank you for your imput anyway, much appreciated :)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Scatter Plots에 대해 자세히 알아보기

질문:

P_L
2019년 2월 28일

댓글:

P_L
2019년 3월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by