Plot function adding line from last point in row to origin

조회 수: 15 (최근 30일)
Radhika Kulkarni
Radhika Kulkarni 2021년 2월 23일
댓글: Walter Roberson 2021년 2월 27일
Hello,
I currently have a plot that looks like this:
and I am trying to remove the line that is connecting the last node in the row to the origin. I know this question has been asked before but I was unable to use the answers to solve my problem. I tried sorting the data and tried stating LineStyle to none but it didn't work. Here is what I have so far:
plot(transpose(x_nudged),transpose(y_nudged),'-')
x_nudged(x_nudged==0)=nan;
y_nudged(y_nudged==0)=nan;
  댓글 수: 1
Walter Roberson
Walter Roberson 2021년 2월 23일
Remember that changing your data after you plot is not going to affect your plot.

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

채택된 답변

Walter Roberson
Walter Roberson 2021년 2월 23일
In order to see that plot with multiple lines, your y_nudged must be 2D. The following code takes that into account.
xt = x_nudged.';
if isvector(xt)
xt(end) = [];
else
xt(end,:) = [];
end
yt = y_nudged.';
if isvector(yt)
yt(end) = [];
else
yt(end,:) = [];
end
plot(xt, yt);
  댓글 수: 7
Radhika Kulkarni
Radhika Kulkarni 2021년 2월 27일
I want it to be 15.
Walter Roberson
Walter Roberson 2021년 2월 27일
xt = x_coor.';
yt = y_adj.';
plot(min(xt, 15), yt)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by