Effacer les filtres
Effacer les filtres

Can I draw a section of a polar plot?

13 vues (au cours des 30 derniers jours)
dormant
dormant le 31 Août 2023
Commenté : dormant le 4 Sep 2023
Is it possible to draw only part of a polar plot? That is, when the centre of the plot is outside the viewed plot.
I have a plot of some data close to the Earth's surface, and I want to draw it with the real curvature of the surface. I could do the transformations manually, but I thought a polar plot would be a better way.
Here is my plot.

Réponse acceptée

dpb
dpb le 31 Août 2023
Modifié(e) : dpb le 31 Août 2023
Well, sorta', but not totally generic.
hPax=polaraxes('thetalim',[0 20],'thetazerolocation','top','thetadir','clockwise','rlim',[0 300],'rdir','reverse');
may be something like what you're envisioning, but the 'thetazerolocation' parameter is only one of the four quadrants, it can't be set as an angle to make the 10-degree radius vertical as you would probably prefer. You also can't change the aspect ratio to make the subtended angle fill the total figure/axes space; it is constrained to be only the fraction of the full circle given by the 'thetalim' range.
But, you can make the theta axis symmetric about zero
figure
hPax=polaraxes('thetalim',[-10 10],'thetazerolocation','top','thetadir','clockwise','rlim',[0 300],'rdir','reverse');
and then relabel manually as desired. To plot into the latter, of course, you would have to center your data to match the actual ThetaTick values; the labels now are purely artificial and not the same as the actual tick values.
figure
hPax=polaraxes('thetalim',[-10 10],'thetazerolocation','top','thetadir','clockwise','rlim',[0 300],'rdir','reverse');
hPax.ThetaTickLabel=hPax.ThetaTick+10;
Whether that's useful or not you'll have to decide, is about the closest "out of the box" I think you could get with builtin MATLAB functions.
  8 commentaires
Voss
Voss le 1 Sep 2023
Modifié(e) : Voss le 1 Sep 2023
"this has the same problem as far as the object size goes of not expanding the visible plot to fill the area of the axes"
Of course, you can expand the axes to be partially outside the figure.
figure('Color','r') % red figure so you can see it here
hPax=polaraxes('thetalim',[-10 10],'thetazerolocation','top','thetadir','clockwise','rlim',[0 1500],'rdir','reverse');
hPax.ThetaTickLabel=hPax.ThetaTick+10;
hPax.RTick = 0:150:300;
hPax.Position([2 4]) = [-2 2.815];
And, if you want, obscure the bottom visible part of the axes with another object:
f = figure('Color','r'); % red figure so you can see it here
hPax=polaraxes('thetalim',[-10 10],'thetazerolocation','top','thetadir','clockwise','rlim',[0 1500],'rdir','reverse');
hPax.ThetaTickLabel=hPax.ThetaTick+10;
hPax.RTick = 0:150:300;
hPax.Position([2 4]) = [-2 2.815];
uicontrol(f,'Style','text','BackgroundColor',f.Color,'Units','normalized','Position',[0 -0.01 f.Position(3) 0.1]);
dormant
dormant le 4 Sep 2023
Many thanks for all this. I've used dpb's suggestion.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Polar Plots dans Help Center et File Exchange

Tags

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by