Filling inside of a plot with color (gradient)
Ältere Kommentare anzeigen
I'm coming back to filling areas with color, trying this time to get the most beautiful result:
Here I've got the plain vectorvalued function:
phi = linspace(0,2.*pi,200);
g = (1+cos(phi)).*[cos(phi);sin(phi)];
gx = (1,:);
gy = (2,:);
My first attempt was using polyshape because it was the very thirst thing one gave into my hands:
plot(polyshape(gx,gy))
However, this gives a warning, that I can't preempt. Alhough it's just a warning, it really triggers.
Next try was patch because I've heard about all the magnificent things you can blow up with it, but never dared using it:
patch(gx,gy,1)
what seems to be similar to
fill(fx,gy,1)
surprisingly this works without warning and I should be satisficed (not satisfied).
But while we are at it: how can I implement a color gradient in the given shape? People seem to love color gradients (at least I do) and that's what patch is made for isn't it? It might be done with the last enty related to 'Colorspec', but I didn't get a hang of modifying it...
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Polygonal Shapes finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





