Can I draw a section of a polar plot?
25 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
dpb
2023-8-31
编辑:dpb
2023-8-31
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 个评论
Voss
2023-9-1
编辑:Voss
2023-9-1
"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]);
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polar Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!