How to rotate axis of polarscatter plot?
조회 수: 22 (최근 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에서 Polar Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!