How to rotate axis of polarscatter plot?

36 views (last 30 days)
Gaetan Dufour
Gaetan Dufour on 10 Jan 2019
Commented: Luke Barker on 8 Jan 2020
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:
2019-01-09_17h29_27.png
Can you help me?
thank you very much.
  2 Comments
madhan ravi
madhan ravi on 10 Jan 2019
create a handle for the plot function and use rotate() function ?
Gaetan Dufour
Gaetan Dufour on 10 Jan 2019
thank you madhan, but I think it is not only a rotation, since I want:
- 0° at North
- 90° at East
- 180° at South
- 270° at West
If I make a rotation, I will have 0° at North, 90° at West, 180° at South and 270° at East...

Sign in to comment.

Answers (1)

Steven Lord
Steven Lord on 10 Jan 2019
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 Comment
Luke Barker
Luke Barker on 8 Jan 2020
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)

Sign in to comment.

Categories

Find more on Polar Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!