Can I draw a section of a polar plot?
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
0 Kommentare
Akzeptierte Antwort
dpb
am 31 Aug. 2023
Bearbeitet: dpb
am 31 Aug. 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 Kommentare
Voss
am 1 Sep. 2023
Bearbeitet: Voss
am 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]);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Polar Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!