- use patch() or surface() or one of the derived functions fill() or contourf() to create a closed bounded object which has a face which is coloured with the desired fill colour.
- convert some or all of the axes content into an image in which you have painted the desired fill colour and carefully place the image on the axes.
Fill the plot but it should not be closed by connecting first vertex to the last
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a plot which consists of alternate layers of two species. I need to fill these layers with specified colors but it should not be closed by connecting last vertex to the first. When I use the fill command it connects the vertices and I do not want it that way. Please guide.
0 Kommentare
Antworten (1)
Walter Roberson
am 10 Okt. 2015
There are two ways to handle fill in MATLAB:
I would wonder if the issue is not that you do not want the polygon to be closed, but rather that you do not want the edge to be drawn? An example of what you want would help.
2 Kommentare
Walter Roberson
am 10 Okt. 2015
You would normally proceed by constructing closed boundaries with the first connected to the last. It just might not be the boundaries you thought of at first.
Presuming that the X values are all the same, and letting the red and black lines be columns in Y, then, to fill between columns K and K+1 you would construct
fx = [X(:); flipud(X(:))];
fy = [Y(:,K); flipud(Y(end,K+1))];
col = [0 0 0] or [1 0 0] or as appropriate
fill(fx, fy, col, 'edgecolor', 'none');
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
