How to add a secondary axis to a polarplot on matlab?

조회 수: 8 (최근 30일)
Abraham Hartley
Abraham Hartley 2019년 10월 26일
댓글: Star Strider 2019년 10월 26일
I would like to add a secondary radial axis to a polar graph in order to show the variation of two parameters as theta changes from 0 to 360 degrees. Any help would be much appreciated.

답변 (1개)

Star Strider
Star Strider 2019년 10월 26일
See if this does something similar to what you want:
t = 0 : 2*pi/177 : 2*pi;
a=linspace(0.3,0.5,178);
m=linspace(0.4,0.6,178);
figure(3)
ax = polaraxes;
hold on
polarplot(ax,t,a,'-b')
polarplot(ax,t,m,'-r')
ax.RColor ='blue';
ax.ThetaDir = 'counterclockwise';
ax.ThetaZeroLocation = 'bottom';
thetaticks([0:30:360])
thetaticklabels({'180','150','120','90','60','30','0','330','300','270','240','210'})
rlbl = sprintfc('%.0f',(0:2:6)); % Radius Labels
text(ones(1,4)*1.8*pi, (0:2:6)*0.1, rlbl, 'Color','r') % Label Radii
It does not plot separate radial grids (although that is not difficult to do). It is designed to produce something similar to yyaxis for a polarplot, here one curve and axis in blue and another curve and asxis in red
  댓글 수: 2
Abraham Hartley
Abraham Hartley 2019년 10월 26일
Thank you,
I will give it a go. For interests sake, how would one go about plotting sererate radial grids?
Star Strider
Star Strider 2019년 10월 26일
My pleasure.
Here are grid lines that are not part of the original grid:
addgrid = [0.1; 0.3; 0.5]*ones(size(t)); % Calculate Grid Lines At [0.1 0.3 0.5]
polarplot(ax, t, addgrid, '--k') % Plot Them
Experiment with the line style and radii to get the result you want.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by