Fill in region between data points
Show older comments
Hello all,
Trying to shade a region between my data points. The methods I've tried using don't quite work. I've tried convhull() and boundary() with a shrink factor and can't get the bounded region I'm looking for.
The lower edge of my points get lost in the boundary. See the image. I don't want the blue area in the fill.
Likewise if I had another set of points (in the red) I would want it to follow the top and bottom edge and not try to shortcut the bottom edge.
Any help would be great. Heres my code. The variables x and y are [M x N] N being each set of points on a particular curve.
xx = reshape(x,[size(x,1).*size(x,2),1]); yy = reshape(y,[size(y,1).*size(y,2),1]); k = boundary(yy,xx,.1); fill(xx(k),yy(k),C(ii,1:3)) plot(xx,yy,'ko','linewidth',2) % also tried this: ----------------------- k = convhull(x,y); fill(x(k),y(k),C(ii,1:3)) plot(x,y,'ko','linewidth',2)
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!