How can I fill with color a odd flower in a cartesian o polar coordinates?
Show older comments
% In rectangular coordinates
theta=linspace(0,2*pi,200);
radius=cos(5*theta);
x=radius.*(cos(theta));
y=radius.*(sin(theta));
fill(x,y,'b') % when matlab run, only fill with color not odd flowers
axis('square')
% In polar coordinates
p=Polar(theta,radius,'-b')
patch(get(ph,'XData'), get(ph,'YData'), 'b')
1 Comment
Image Analyst
on 8 Jul 2015
I fixed your formating, and am attaching the screenshot you forgot to include:

Accepted Answer
More Answers (1)
Starting in R2025a, polar axes support patch and surface objects.
There's more info about patch and surface support in polar axes in the Graphics and App Building blog.
theta=linspace(0,2*pi,200);
radius=cos(5*theta);
radius(radius <= 0) = 0;
pax = polaraxes();
patch(pax,theta,radius,'blue',FaceAlpha=0.5)
Categories
Find more on Polar 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!


