How to rotate axis of polarscatter plot?
17 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a timeseries containing the information about peaks of storms overall several years : wave direction and wave height.
I would like to show the information on a polar plot. So I am using the plot function polarscatter, but this function gives automatically 0° at East, 90° at North, 180° at West and 270° at South. I would like to have North at 0°, East at 90°, South at 180° and West at 270°. i tried to look for information in many topics but it seems nobody asked this question.
The function is very easy : polarscatter(direction,wave height)
This is what i get:
Can you help me?
thank you very much.
2 个评论
回答(1 个)
Steven Lord
2019-1-10
The axes in which a polarscatter plot is located is a polaraxes. The polaraxes object has a large number of properties for controlling the theta and r behavior and appearance.
Let's create a sample polarscatter using the example from its help text.
t = 0:.05:2*pi;
h = polarscatter(t,sin(2*t).*cos(2*t),101 + 100*(sin(2*t)),cos(2*t));
Using the polarscatter handle, retrieve its parent polaraxes.
ax = ancestor(h, 'polaraxes')
Two of the properties that are displayed in the default view look like they're relevant.
ax.ThetaZeroLocation = 'top';
ax.ThetaDir = 'clockwise';
The documentation for the polaraxes function lists several of the common properties that you can set using name-value pair arguments, and the See Also section on that documentation page links to the PolarAxes properties page that lists more. [You can set the settable properties listed on the properties page using name-value pairs, even if they don't appear on the polaraxes property page.]
1 个评论
Luke Barker
2020-1-8
I tried this on a compass but I get this error...
Unable to perform assignment because dot indexing is not supported for variables of this type.
Error in Visualize directional data with compass plot 4 (line 51)
ax.ThetaZeroLocation = 'top';
Z = compass(u,v);
colors = get(0,'DefaultAxesColorOrder')
ax = ancestor(Z, 'polaraxes');
ax.ThetaZeroLocation = 'top';
%ax.ThetaDir = 'clockwise';
set(Z,'color',colors(1,:),'linewidth',4)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Distribution Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!