How to draw a sidebar in polar plotting?

2 views (last 30 days)
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 Comments
Star Strider
Star Strider on 24 Dec 2021
What does the sidebar represent, what are the units, and does it have a specific relation to the polar plot?
Wiqas Ahmad
Wiqas Ahmad on 24 Dec 2021
the polar plot reprsents the distribution of light while the vertical bar represents the scattering intesity in units of steradian

Sign in to comment.

Accepted Answer

Chunru
Chunru on 24 Dec 2021
theta =0:(pi/180): (2*pi);
r = cos(theta)
r = 1×361
1.0000 0.9998 0.9994 0.9986 0.9976 0.9962 0.9945 0.9925 0.9903 0.9877 0.9848 0.9816 0.9781 0.9744 0.9703 0.9659 0.9613 0.9563 0.9511 0.9455 0.9397 0.9336 0.9272 0.9205 0.9135 0.9063 0.8988 0.8910 0.8829 0.8746
ax=subplot(221);
polar(theta, r);
pos = ax.Position
pos = 1×4
0.1300 0.5838 0.3347 0.3412
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';

More Answers (0)

Categories

Find more on Discrete Data 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!