フィルターのクリア

Heatmap and Contour figures in Matlab

1 回表示 (過去 30 日間)
Jack
Jack 2014 年 7 月 21 日
コメント済み: Jack 2014 年 7 月 24 日
Suppose that I have this information that first column is feature one of a motor, Second column is feature two and column three is response (in this case performance of motor).
[34 56 100
12 12 80
7 6 60
3 4 20
1 1 10.5
0 0 1]
I want have something like heatmap or contour that for example I have a warmer (for instance red color) for first row in matrix and more light color for row two and etc. What should I do?
Thanks.

採用された回答

Arun Mathew Iype
Arun Mathew Iype 2014 年 7 月 22 日
The 3D bar should be ideal for this. Please have a look at the sample below.
data =[34 56 100;
12 12 80 ;
7 6 60;
3 4 20;
1 1 10.5;
0 0 1];
figure;
%flipping the data to get a better view
h = bar3(flip(data',2));
colorbar;
You can also explore contour and pcolor for advanced options in the below links. There are examples provided there. http://www.mathworks.com/help/matlab/ref/pcolor.html http://www.mathworks.com/help/matlab/ref/contour.html
  3 件のコメント
Arun Mathew Iype
Arun Mathew Iype 2014 年 7 月 22 日
Heres a sample code:
% flip data in order to get proper plot using pcolor
data1 = flip(data,1)
% inserting values as pcolor ignores last row and column
data1(7,:) =[0 0 0]
data1(:,4) =[0 0 0 0 0 0 0]
%plotting using pcolor
pcolor(data1)
% inserting the color bar
colorbar;
Please "accept" the answer if its helpful
Jack
Jack 2014 年 7 月 24 日
I think there is a problem in your charts. For example in bar3 I want have column 1 values as X, Column 2 values as Y and column 3 values as Z, but here you only plot 18 values separately.

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

その他の回答 (0 件)

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by