フィルターのクリア

Scatter plot with extra features

2 ビュー (過去 30 日間)
BeeTiaw
BeeTiaw 2019 年 3 月 13 日
コメント済み: BeeTiaw 2019 年 3 月 19 日
Hi expert,
I want to create a scatter plot where each individual points have one extra information which I also want to plot, i.e. their azimuth.
The data is shown below
data=[
% Temp Pres Azim
41 78 45
66 44 0
170 66 120
136 27 100
137 52 110];
The azimuth listed in the third column of the data is measured from the top of each data points (or circle) clockwise from [0,360deg].
How do I do this? The following plot has been generated manually by adding the blue line that shows the azimuth of each points.
Picture3.png
Thank you!

採用された回答

Guillaume
Guillaume 2019 年 3 月 13 日
halflength = 2;
scatter(data(:, 1), data(:, 2), 'MarkerEdgeColor', 'b', 'MarkerFaceColor', 'r')
for row = 1:size(data, 1)
line(data(row, 1) + sind(data(row, 3)) * [-halflength, halflength], ...
data(row, 2) + cosd(data(row, 3)) * [-halflength, halflength], ...
'Color', 'b');
end
  4 件のコメント
Guillaume
Guillaume 2019 年 3 月 14 日
Indeed, make sure the aspect ratio is is the same on both axis.
BeeTiaw
BeeTiaw 2019 年 3 月 19 日
Thanks @Akira Agata!

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

その他の回答 (1 件)

Akira Agata
Akira Agata 2019 年 3 月 13 日
How about using quiver function? Here is an example.
data = [
% Temp Pres Azim
41 78 45
66 44 0
170 66 120
136 27 100
137 52 110];
u = 10*sind(data(:,3));
v = 10*cosd(data(:,3));
figure
scatter(data(:,1),data(:,2))
hold on
quiver(data(:,1)-u/2,data(:,2)-v/2,u,v,'AutoScale','off')
daspect([1 1 1])
xlabel('Temp','FontSize',12)
ylabel('Pres','FontSize',12)
box on
grid on
quiver.png

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by