How to rotate axis of polarscatter plot?

조회 수: 22 (최근 30일)
Gaetan Dufour
Gaetan Dufour 2019년 1월 10일
댓글: Luke Barker 2020년 1월 8일
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
madhan ravi
madhan ravi 2019년 1월 10일
create a handle for the plot function and use rotate() function ?
Gaetan Dufour
Gaetan Dufour 2019년 1월 10일
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...

댓글을 달려면 로그인하십시오.

답변 (1개)

Steven Lord
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
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 CenterFile Exchange에서 Polar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by