How to draw a sidebar in polar plotting?
조회 수: 2 (최근 30일)
이전 댓글 표시
How can I draw a sidebar (red encircled) with a polar plot as shown in figure.
My program and figure are given below:
clc;
clear all;
close all;
%% ------------------------------Program-------------------------------------
N0=100;
r_med=[0.445 0.889 1.445 8];
sigma_g=7;
N_ang=91;
theta =0:(pi/180): (2*pi);
Num_r = 50e3;
r = linspace(1,50,Num_r)./2;
col=['k' 'b' 'r' 'g'];
for i=1:length(r_med)
[s1(i,:),s2(i,:),~,~,~,~]=bhmie(r_med(i),1.33,91)
cs1(i,:)=conj(s1(i,:));
cs2(i,:)=conj(s2(i,:));
ph_ft(i,:)=s1(i,:).*cs1(i,:)+s2(i,:).*cs2(i,:);
Rs1(i,:)=real(s1(i,:));
Rs2(i,:)=real(s2(i,:));
phf(i,:)=[ph_ft(i,:) fliplr(ph_ft(i,2:181))];
polarplot(theta,phf(i,:));
end
%% -------------------------------Title--------------------------------------
figure('name','Polar plot of scattering phase')
subplot(2,2,1,polaraxes);
hold on
polarplot(theta,phf(1,:),'color',col(1),'Linewidth',1.5);
title('\bf (a) Scattering phase function','FontSize',...
16,'FontWeight','normal')%\bf(bold font),\rm(normal font),\it(italian font)
legend('R_{e}=4\mum','location','south','FontSize',12);
legend boxoff
set(gca,'color','w','Fontsize',12,'LineWidth',1,'Fontweight','normal');
set(gca,'box','on','Fontname','Arial','Fontsmoothing','on');
%%
subplot(2,2,2,polaraxes);
hold on
polarplot(theta,phf(2,:),'color',col(2),'Linewidth',1.5);
title('\bf (b) Scattering phase function','FontSize',...
16,'FontWeight','normal')%\bf(bold font),\rm(normal font),\it(italian font)
legend('R_{e}=8\mum','location','south','FontSize',12);
legend boxoff
set(gca,'color','w','Fontsize',12,'LineWidth',1,'Fontweight','normal');
set(gca,'box','on','Fontname','Arial','Fontsmoothing','on');
%%
subplot(2,2,3,polaraxes);
hold on
polarplot(theta,phf(3,:),'color',col(3),'Linewidth',1.5);
title('\bf (c) Scattering phase function','FontSize',...
16,'FontWeight','normal')%\bf(bold font),\rm(normal font),\it(italian font)
legend('R_{e}=13\mum','location','south','FontSize',12);
legend boxoff
set(gca,'color','w','Fontsize',12,'LineWidth',1,'Fontweight','normal');
set(gca,'box','on','Fontname','Arial','Fontsmoothing','on');
%%
subplot(2,2,4,polaraxes);
hold on
polarplot(theta,phf(4,:),'color',col(4),'Linewidth',1.5);
title('\bf (d) Scattering phase function','FontSize',...
16,'FontWeight','normal')%\bf(bold font),\rm(normal font),\it(italian font)
legend('R_{e}=72\mum','location','south','FontSize',12);
legend boxoff
set(gca,'color','w','Fontsize',12,'LineWidth',1,'Fontweight','normal');
set(gca,'box','on','Fontname','Arial','Fontsmoothing','on');
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[.3 .05 .45 .75])
print(gcf,'Polar plot of scattering phase.tiff','-dtiff','-r300');
댓글 수: 2
Star Strider
2021년 12월 24일
What does the sidebar represent, what are the units, and does it have a specific relation to the polar plot?
채택된 답변
Chunru
2021년 12월 24일
theta =0:(pi/180): (2*pi);
r = cos(theta)
ax=subplot(221);
polar(theta, r);
pos = ax.Position
pos(1) = pos(1)-0.05; % adjust pos to fit your need
ax1 = axes('Position', pos, 'Color', 'none');
ax1.XAxis.Visible = 'off'; % turn off x axis
ax1.YLim = [-2 2];
ax1.YLabel.String = "Phase Function sr^1";
ax1.YMinorTick = 'on';
ax1.TickDir = 'out';
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Discrete Data Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!