# caxis with HeatMap?

조회 수: 36(최근 30일)
D 2011년 7월 6일
I'd like to specify the scale of the colormap used for a heat map.
It seems that something like caxis would be appropriate but it doesn't appear to work. All of the examples are for functions like surf.
Is there a way to use caxis to do this, or something else that would work for a heat map?
Thanks very much.

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

### 채택된 답변

Patrick Kalita 2011년 7월 6일
Maybe I should have mentioned this in the answer to your previous question, but maybe the HeatMap object's plot method would be useful here. That method will render the heatmap image into a standard MATLAB axes. Then you can use all the standard graphics functions like colorbar and caxis with it.
For example:
data = gallery('invhess',20);
hm = HeatMap(data);
ax = hm.plot; % 'ax' will be a handle to a standard MATLAB axes.
colorbar('Peer', ax); % Turn the colorbar on
caxis(ax, [-3 10]); % Adjust the color limits
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
D 2011년 7월 19일
Just to clarify: the extra grey space shows up when I try to resize the figure. The heat map expands a little, but most of the expansion in the figure window is the grey space.
Also, I have code for the title, but it does this strange thing where every part of the string is on a different line.
title(ax, ['Plot ' num2str(p) ': ' list(p)]);
where p is an index for this particular plot (I'm doing these in a loop) and where list = {'abcd'; 'efgh'}.
So, it should read something like: "Plot 1: abcd" and "Plot 2: efgh". Instead I get
Plot
1
:
abcd
At first, I thought this might be because the figure is too small, but after expanding the figure, the title didn't expand to the full length of the plot area.

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

### 범주

Find more on Data Distribution Plots in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!