Annular polar plot with an offset origin

11 visualizzazioni (ultimi 30 giorni)
Drepanon
Drepanon il 17 Ago 2021
Risposto: Drepanon il 20 Ago 2021
Hi,
Is it possible to create a polar plot with an offset origin, such as it creates an "annulus" (examples below)?
Thank you for you help.
  1 Commento
Adam Danz
Adam Danz il 17 Ago 2021
Modificato: Adam Danz il 17 Ago 2021
No, Matlab does not have a method of producing the first plot you shared. You could produce two separate plots for the blue and red segments and then combine them using an image editor. For example, you could set thetalim to limit the range of angular values.

Accedi per commentare.

Risposta accettata

Dave B
Dave B il 17 Ago 2021
As @Adam Danz describes above, there's no built in way to do either the annulus part or the wedge part.
But, as with many things in MATLAB graphics, if you really wanted to, you could fake it:
  • You can fake the center 'hole' with another polaraxes.
  • Getting clipping on the outer border like you have in the chart on the right would be tricky (bubblecharts do this in Cartesian but not Polar axes).
  • For the one on the left you could drop ticks in the unlabeled wedges and add a few stronger lines to box in the wedges.
Here's some messy (off the top of my head) code to get started if you're eager to hack some simulated annular plots:
t=tiledlayout(1,2);
nexttile
th=linspace(pi/3,5*pi/6,100);
r=smooth(2*rand(1,100)+3,10);
polarplot(th,r,'b','linewidth',2);
hold on
polarplot([min(th) min(th)],[2 6],'k-')
polarplot([max(th) max(th)],[2 6],'k-')
polarplot(linspace(min(th),max(th),50),repelem(6,50),'k-')
rticks(2:6)
p1=gca;
p1.RMinorGrid='on';
p1.RAxis.MinorTickValues=2.5:5.5;
p1.ThetaMinorGrid='on';
p1.ThetaAxis.MinorTickValues=[75:30:135 247.5:15:302.5];
th=linspace(4/3*pi,2*pi,100);
r=smooth(2*rand(1,100)+3,10);
polarplot(th,r,'r','linewidth',2);
rlim([0 6])
thetaticks([60:30:150 240:15:360])
polarplot([min(th) min(th)],[2 6],'k-')
polarplot([max(th) max(th)],[2 6],'k-')
polarplot(linspace(min(th),max(th),50),repelem(6,50),'k-')
p2=polaraxes;
rticks([])
thetaticks([])
cx=p1.Position(1)+p1.Position(3)/2;
cy=p1.Position(2)+p1.Position(4)/2;
p2.Position=[cx-.065 cy-.065 .13 .13];
hold on
polarplot(linspace(0,2*pi,100),ones(1,100),'k-','linewidth',1)
rlim([0 1])
nexttile(t)
th=rand(1,100)*2*pi;
r=2*rand(1,100)+3;
polarbubblechart(th,r,r,th)
rlim([0 6])
bubblesize([1 10])
rticks(3:.5:6);
p1=gca;
hold on
polarplot(linspace(0,2*pi,100),repelem(max(rlim),100),'k-','linewidth',1)
colormap turbo
drawnow
p2=polaraxes;
rticks([])
thetaticks([])
cx=p1.Position(1)+p1.Position(3)/2;
cy=p1.Position(2)+p1.Position(4)/2;
p2.Position=[cx-.1 cy-.1 .2 .2];
%p2.LineWidth=1;
hold on
polarplot(linspace(0,2*pi,100),ones(1,100),'k-','linewidth',1)
rlim([0 1])

Più risposte (1)

Drepanon
Drepanon il 20 Ago 2021
Thanks for your answer, will try that.

Categorie

Scopri di più su Polar Plots in Help Center e File Exchange

Tag

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by