フィルターのクリア

How to use percentages in my wind rose

21 ビュー (過去 30 日間)
Heidi Hirsh
Heidi Hirsh 2019 年 2 月 5 日
コメント済み: Satoshi Kobayashi 2019 年 2 月 6 日
I am trying to change my wind rose so that it shows percentages for each magnitude and direction instead of the number of data points (currently labeled as 1x10^4, 2x10^4, 3x10^4). This is the code I am currently using (where wspeed is windspeed (m/s) and wdir is direction in degrees):
pax = polaraxes;
polarhistogram(deg2rad(wdir(wspeed<20)),deg2rad(0:10:360),'FaceColor','red','displayname','15 - 20 m/s')
hold on
polarhistogram(deg2rad(wdir(wspeed<15)),deg2rad(0:10:360),'FaceColor','yellow','displayname','10 - 15 m/s')
polarhistogram(deg2rad(wdir(wspeed<10)),deg2rad(0:10:360),'FaceColor','green','displayname','5 - 10 m/s')
polarhistogram(deg2rad(wdir(wspeed<5)),deg2rad(0:10:360),'FaceColor','blue','displayname','0 - 5 m/s')
pax.ThetaDir = 'clockwise';
pax.ThetaZeroLocation = 'top';
legend('Show')
title('Wind')windrose.png

採用された回答

Satoshi Kobayashi
Satoshi Kobayashi 2019 年 2 月 6 日
編集済み: Satoshi Kobayashi 2019 年 2 月 6 日
numberOfMeasurement = sum(wspeed<20);
p = 1:10;
rticks(p/100*numberOfMeasurement)
rticklabels(strcat(string(p),'%'))
  3 件のコメント
Heidi Hirsh
Heidi Hirsh 2019 年 2 月 6 日
I apologize; I just realized your code is a lot closer than I realized. I think if I changed the wspeed<20 part to a number closer to my max (16.24 I think) then if might be very close to what I want. Thank you for your help!
Satoshi Kobayashi
Satoshi Kobayashi 2019 年 2 月 6 日
I recommend you to add another line to set the r-axis limits in this method.
rlim([0 10/100*numberOfMeasurement])

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by