How to create heatmap chart
12 ビュー (過去 30 日間)
古いコメントを表示
I have dataset of matrix 45x9 with variables 'station' and the other 8 are heavy metals concentration. I want to plot a heatmap to show which station have the highest and lowest concentration, instead in values. The 'station' will be y and the heavy metals concentration will be x. A coding of a heatmap chart of station and one of the the heavy metals concentration would be suffice, but if possible i would like the coding for heatmap chart of station and all the heavy metals.
採用された回答
Cris LaPierre
2022 年 8 月 16 日
編集済み: Cris LaPierre
2022 年 8 月 16 日
I would use the following syntax:
You haven't shared your station names, so this approach uses the values in the table (loaded as strings).
fileNm = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/1099640/HMCSV.csv';
opts = detectImportOptions(fileNm);
opts = setvartype(opts,'Station','string');
data = readtable(fileNm,opts)
% Create heatmap
heatmap(data.Properties.VariableNames(2:end),data.Station,data{:,2:end})
% Default color is shades of blue. This changes it to blue->black
colormap jet
The values will appear if you make the figure bigger (maximize it on your computer).
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Distribution Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!