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

15 visualizaciones (últimos 30 días)
roudan el 29 de En. de 2018
Comentada: roudan el 30 de En. de 2018
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?
##### 0 comentariosMostrar -2 comentarios más antiguosOcultar -2 comentarios más antiguos

Iniciar sesión para comentar.

Walter Roberson el 29 de En. de 2018
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 comentarioMostrar -1 comentarios más antiguosOcultar -1 comentarios más antiguos
roudan el 30 de En. de 2018
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);

Iniciar sesión para comentar.

### Categorías

Más información sobre Scatter Plots en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by