フィルターのクリア

bars at specific (x,y) points

10 ビュー (過去 30 日間)
Michela Longhi
Michela Longhi 2017 年 10 月 12 日
回答済み: Star Strider 2017 年 10 月 12 日
I need to create a 3d bar plot with bars at specific (x,y) points. Where X and Y are the coordinates and the temperature column is the corresponding temperature value at each coordinate.
Can someone help me, please?
Thank you so much !!
Michela
X Y Temperature
3 28 26.711
4 28 26.711
5 28 26.532
5 27 26.532
5 26 26.711
5 25 26.532
5 24 26.352
5 23 26.352
5 22 26.711
5 21 26.352
5 20 26.173
5 19 26.173
5 18 26.173
5 17 26.173
5 16 26.173
5 15 26.352
5 14 26.352
5 13 26.173
5 12 26.352
5 11 26.173
5 10 25.993
5 9 25.993
5 8 26.173
5 7 26.173
5 6 26.173
5 5 25.814
5 4 25.993
5 3 26.173
5 2 26.173
5 1 25.993
5 0 25.814
4 0 25.993
3 0 25.993
2 0 25.993
1 0 26.173
0 0 26.173
0 1 26.173
0 2 26.352
0 3 26.173
0 4 26.173
0 5 26.352
0 6 26.352
0 7 26.532
0 8 26.352
0 9 26.352
0 10 26.532
0 11 26.711
0 12 26.711
0 13 26.711
0 14 26.891
0 15 27.071
0 16 26.891
0 17 26.891
0 18 27.071
0 19 27.071
0 20 27.071
0 21 27.071
0 22 27.071
0 23 27.071
0 24 27.43
0 25 27.071
0 26 27.25
0 27 27.25
0 28 27.25
0 29 27.071
0 30 27.071
0 31 27.25
0 32 27.071
0 33 27.25
0 34 27.25
0 35 27.25
0 36 27.25
0 37 27.25
0 38 27.25
0 39 27.25
0 40 27.609
0 41 27.43
0 42 27.43
0 43 27.609
0 44 27.43
0 45 27.609
0 46 27.43
0 47 27.43
0 48 27.43
0 49 27.789
0 50 27.609
0 51 27.609
0 52 27.43
0 53 27.43
0 54 27.25
0 55 27.43
0 56 27.43
0 57 27.25
0 58 27.071
0 59 27.25
0 60 27.25
1 60 27.43
2 60 27.43
3 60 27.43
4 60 27.25
5 60 27.25
5 59 27.43
5 58 27.25
5 57 27.25
5 56 27.25
5 55 27.43
5 54 27.43
5 53 27.25
5 52 27.43
5 51 27.43
5 50 27.25
5 49 27.071
5 48 27.25
5 47 27.43
5 46 27.25
5 45 27.25
5 44 27.25
5 43 27.25
5 42 27.071
5 41 27.43
5 40 27.25
5 39 27.25
5 38 27.25
5 37 27.25
5 36 27.25
5 35 27.25
  1 件のコメント
dpb
dpb 2017 年 10 月 12 日
Matlab can't do that out of the box... :( bar3() is seriously weak in its abilities.
Might search on File Exchange...

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

採用された回答

KL
KL 2017 年 10 月 12 日
You need to store the temperature values in a 2D matrix considering x, y values as row and column indices. For example,
data = [3 28 26.711
4 28 26.711
5 28 26.532
5 27 26.532
5 26 26.711];
barData = zeros(max(data(:,1)),max(data(:,2)));
for k = 1:length(data(:,1))
barData(data(k,1),data(k,2))=data(k,3);
end
bar3(barData)
But remember, you have 0 in x and y coordinates, that's not possible this way. You need to include an offset for this case.

その他の回答 (1 件)

Star Strider
Star Strider 2017 年 10 月 12 日
If ‘D’ are your data, so that ‘D(:,1)=X’, ‘D(:,2)=Y’, ‘D(:,3)=T’, try this:
H3 = accumarray(D(:,[1 2])+1, D(:,3), [], @mean);
X = min(D(:,1)):max(D(:,1));
Y = min(D(:,2)):max(D(:,2));
figure(1)
bar3(H3)
grid on

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by