# How can I set an axis outside the polar figure

조회 수: 6(최근 30일)
zein 2020년 8월 22일
댓글: zein 2020년 8월 28일
How can i set the pola axis outside the figure and to set it to be starting from 70 not zero
the original figue is shown below
figure(2)
set(gcf,'color','w');
ax = polaraxes('Position', [0.25 0.25 0.6 0.6])
polarplot (theta,splbn(21,:));
ax.ThetaZeroLocation = 'left';
rlim([70,120])
ax.RTickLabel = [];
ticks = [-flip(ax.RTick(2:end)) ax.RTick];
a = axes('Color', 'none',...
'XColor', 'none',...
'Position', ax.Position,...
'YLim', [-ax.RLim(2) ax.RLim(2)],...
'YTick', ticks,...
'YTickLabel', abs(ticks));
ylabel(a, 'r axis label')
the ouput of the code is shown below
how i can modify the axis to be sarting from 70 min of (rlim) not zero ?

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

### 채택된 답변

jonas 2020년 8월 22일
편집: jonas 2020년 8월 22일
I've modified your code. Not sure how robust this solution is, but you can try this:
figure(2)
set(gcf,'color','w');
ax = polaraxes('Position', [0.25 0.25 0.6 0.6])
ax.ThetaZeroLocation = 'left';
rlim([70,120])
ax.RTickLabel = [];
ticks = [-flip(ax.RTick(2:end)) ax.RTick];
a = axes('Color', 'none',...
'XColor', 'none',...
'Position', [ax.Position(1),ax.Position(2)+ax.Position(4)/2,...
ax.Position(3),ax.Position(4)/2],...
'YLim', [ax.RLim(1) ax.RLim(2)],...
'YTick', ticks,...
'YTickLabel', abs(ticks));
a_m = copyobj(a,gcf)
a_m.Position = a.Position - [0 a.Position(4),0,0];
a_m.YAxis.Direction = 'reverse';
ylabel(a, 'r axis label')
a.YAxis.Label.Position = [a.YAxis.Label.Position(1),70,0];
##### 댓글 수: 4표시숨기기 이전 댓글 수: 3
zein 2020년 8월 28일
I have modified these lines and the problem solved after adding ax.RTick
rmin=70;rmax=130;
ax.RTick = [rmin:10:rmax]
ax.RTickLabel = [];
ticks=[-rmax:10:-rmin,rmin:10:rmax];

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

### Community Treasure Hunt

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

Start Hunting!

Translated by