Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

極座標でのプロット

ここに示す例では、極座標でライン プロット、散布図およびヒストグラムを作成する方法を説明します。極座標プロットで座標軸の範囲に注釈を付けたり、範囲を変更する方法についても説明します。

極座標プロットの作成

極座標でアンテナの放射パターンを可視化します。変数 theta と変数 rho が含まれているファイル antennaData.mat を読み込みます。変数 rho は、theta の各値についてアンテナの放射強度を測定したものです。関数 polarplot を使用して極座標にデータをプロットすることにより、この放射パターンを可視化します。

load('antennaData.mat')

figure
polarplot(theta,rho)

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type line.

R2022a より前の場合は、既定で極座標軸に度記号は含まれません。追加するには、pax = gca を使用して極座標軸を取得します。その後、pax.ThetaTickLabel = string(pax.ThetaTickLabel) + char(176) を使用して目盛りラベルを変更します。

複数の極座標プロット

hold on を使用して現在の極座標軸を維持し、polarplot を使用して追加のデータをプロットします。

rng('default')
noisy = rho + rand(size(rho)); 
hold on
polarplot(theta,noisy)
hold off

Figure contains an axes object with type polaraxes. The polaraxes object contains 2 objects of type line.

極座標プロットの注釈

legendtitle などの注釈関数を使用して、他の可視化タイプと同じように極座標プロットにラベルを付けます。

legend('Original','With Noise')
title('Antenna Radiation Pattern')

Figure contains an axes object with type polaraxes. The polaraxes object contains 2 objects of type line. These objects represent Original, With Noise.

極座標軸の範囲の変更

既定では、半径の負の値は、極座標プロットでは正の値としてプロットされます。rlim を使用して、負の値を含めるように r 軸の範囲を調整します。

rmin = min(rho);
rmax = max(rho);
rlim([rmin rmax])

Figure contains an axes object with type polaraxes. The polaraxes object contains 2 objects of type line. These objects represent Original, With Noise.

thetalim を使用して theta 軸の範囲を 0 ~ 180 に変更します。

thetalim([0 180])

Figure contains an axes object with type polaraxes. The polaraxes object contains 2 objects of type line. These objects represent Original, With Noise.

極座標の散布図の作成

極座標で風速データをプロットします。変数 directionspeedhumidityC が含まれているファイル windData.mat を読み込みます。関数 polarscatter を使用して極座標のデータをプロットすることにより、この風パターンを可視化します。

load('windData.mat')
polarscatter(direction,speed)

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type scatter.

マーカーのサイズを変更するための 3 番目のデータ入力を追加し、3 番目の次元を表します。

polarscatter(direction,speed,humidity)

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type scatter.

書式設定の入力を使用して、マーカーの表示プロパティを調整します。

polarscatter(direction,speed,humidity,C,'filled')

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type scatter.

極座標のヒストグラム プロットの作成

風配図と呼ばれる視覚的表現を生成する関数 polarhistogram を使用して、データを可視化します。

polarhistogram(direction)

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type histogram. This object represents direction.

ビン決定アルゴリズムを指定します。関数 polarhistogram にはさまざまなビン数およびビン幅の決定アルゴリズムがあり、その中から選択したものを BinMethod フィールドに指定できます。

polarhistogram(direction,'BinMethod','sqrt')

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type histogram. This object represents direction.

ビンの数とビンの幅を指定します。

polarhistogram(direction,24,'BinWidth',.5)

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type histogram. This object represents direction.

正規化方式を指定し、塗りつぶしがすべて除外されるよう表示スタイルを調整します。

polarhistogram(direction,'Normalization','pdf','DisplayStyle','stairs')

Figure contains an axes object with type polaraxes. The polaraxes object contains an object of type histogram. This object represents direction.

参考

| | | | |