How do I create a polar plot with concentric colored rings corresponding to single values?
조회 수: 6 (최근 30일)
이전 댓글 표시
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
Walter Roberson
2015년 10월 6일
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.
채택된 답변
Walter Roberson
2015년 10월 7일
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!