필터 지우기
필터 지우기

How to plot heatmaps inside a table?

조회 수: 3 (최근 30일)
z3m
z3m 2022년 2월 13일
댓글: AndresVar 2022년 2월 14일
I want to plot a figure like the following picture, but I don't know how to deal with the grouped row headings. Any hint will be appreciated!

채택된 답변

AndresVar
AndresVar 2022년 2월 14일
Maybe just have different axis for each radar. There are a few ways, but tiledlayout is easiest:
heatvals = rand(4,40); % random data for 1 radar
% labels with prefix
y_labels = split(num2str(1:4));
y_labels = strcat('Target',{' '}, y_labels);
% tiledlayout with tight spacing
tlo = tiledlayout(2,1,'TileSpacing','tight');
% using imagesc to show colormaped data
h(1)=nexttile(tlo);
imagesc(heatvals)
yticklabels(y_labels)
xticklabels([]); % hide xlabels here
ylabel('Radar1')
h(2)=nexttile(tlo); % for radar2
imagesc(heatvals);
yticklabels(y_labels)
ylabel('Radar2')
% same colormap for the tiles
cb = colorbar;
set(h, 'Colormap', flipud(hot), 'CLim', [0 1])
cb.Layout.Tile = 'east';
  댓글 수: 2
z3m
z3m 2022년 2월 14일
Thanks for your nice answer! But when I run your code, I get "Error setting property 'TileSpacing' of class 'TiledChartLayout':
'tight' is not a valid value.". Is this the problem of my matlab version? I'm using R2019b.
AndresVar
AndresVar 2022년 2월 14일
yes it looks like tight is not an option in R2019b, maybe you can try 'none' or 'compact'
in this case 'none' is similar to 'tight' since it doesn't have xtickslabels

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Distribution Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by