How do I create a polar plot with concentric colored rings corresponding to single values?
5 views (last 30 days)
Show older comments
I am trying to create a plot that looks like this with rings of constant values (colors) extending from 0 to 100 in 10 unit increments.
However, my code is not producing this, and I do not know where it has gone wrong.
% values representing the colors that each ring should be, starting from the center and moving outwards in 10 unit increments.
values = [364,358,354,348,339,335,330,325,320,310];
xCoord = linspace(0,2*pi,10);
yCoord = linspace(0,100,10);
[TH,R] = meshgrid(xCoord,yCoord);
[X,Y] = pol2cart(TH,R);
[Z] = meshgrid(values);
contour_ticks = 300:5:375;
figure
hold on
contourf(X,Y,Z,contour_ticks);
a=gca;
cb=colorbar;
colormap('jet');
caxis([300 375]);
This produces a plot resembling this:
Any ideas what I'm doing wrong? Any help is greatly appreciated. Thanks.
2 Comments
Walter Roberson
on 6 Oct 2015
Please clarify the difference between this question and your earlier question http://uk.mathworks.com/matlabcentral/answers/246931-how-do-i-create-circular-patches-within-two-radii . I have no desire to waste my time answering two apparently different questions that might turn out to be the same question.
Accepted Answer
Walter Roberson
on 7 Oct 2015
contourf(X,Y,Z',contour_ticks,'edgecolor','none');
Note: with your code as-is you are going to end up with a white dividing line at the origin. Your circle is not completely closed; I have not checked out why not.
More Answers (0)
See Also
Categories
Find more on Contour 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!