フィルターのクリア

how to plot the lower or upper boundary lines for scatter data?

21 ビュー (過去 30 日間)
roudan
roudan 2018 年 1 月 29 日
コメント済み: roudan 2018 年 1 月 30 日
Hi
I have a scatter plot. I'd like to plot the lines connecting the points either the upper or lower bound.
How to do it?
Could you please help? Thank you so much.

採用された回答

Walter Roberson
Walter Roberson 2018 年 1 月 29 日
You could use boundary() to help figure out which points are on the perimeter. Figuring out which of those points are on the upper or lower branch might take some thinking for irregular point distributions.
  1 件のコメント
roudan
roudan 2018 年 1 月 30 日
Thanks Walter. It indeed takes some time to figure out how to find the lower bounds points.
Here are my codes and it works for my case
% if trendline is for boundary line
if ~isempty(strfind(trendlinecoverage,'bound')) % find the lowerbound string
k=boundary(xdata_crossplot',ydata_crossplot'); % have to be column vector
boundarypoint=[];
startx=k(1);
maxindex=length(k);
boundarypoint=[boundarypoint startx];
for i=2:maxindex
currentpointindex=k(i);
previouspointindex=k(i-1);
if xdata_crossplot(currentpointindex)>xdata_crossplot(previouspointindex) % we are moving in x+ direction to find the lower boundary point
boundarypoint=[boundarypoint k(i)];
end
end
hold(hrightsubplot,'on');
legendlabel_boundary='lower boundary line'
hp=plot(hrightsubplot,xdata_crossplot(boundarypoint),ydata_crossplot(boundarypoint),'-b','linewidth',2,'DisplayName',legendlabel_boundary);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by