How to rotate axis of polarscatter plot?

22 visualizaciones (últimos 30 días)
Gaetan Dufour
Gaetan Dufour el 10 de En. de 2019
Comentada: Luke Barker el 8 de En. de 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 comentarios
madhan ravi
madhan ravi el 10 de En. de 2019
create a handle for the plot function and use rotate() function ?
Gaetan Dufour
Gaetan Dufour el 10 de En. de 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...

Iniciar sesión para comentar.

Respuestas (1)

Steven Lord
Steven Lord el 10 de En. de 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 comentario
Luke Barker
Luke Barker el 8 de En. de 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)

Iniciar sesión para comentar.

Categorías

Más información sobre Polar Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by