Setting the scale of colorbar while plotting heatmap

조회 수: 165 (최근 30일)
Deepa Maheshvare
Deepa Maheshvare 2019년 10월 22일
답변: Sebastian Bomberg 2019년 10월 22일
I am trying to plot multiple heatmaps using subplot
for i = 1:10
x(i).data = rand(10,10)
end
scale = 1:10;
p =1;
for j = 1:length(x)
subplot(5,2,p)
heatmap(scale(j)*x(i).data)
p =p+1;
end
In the output figure, the colorbar remains the same for all subplots even if the magnitude of values differ in each case.
For instance in subplot(5,2,1) values range from 0 to 1 and in subplot(5,2,2) values range from 0 to 2. However, I see the same color bar for both the subplots.
I'd like to know if there is a way to assign colors based on magnitude of values, something like a common colorscale for all subplots.

답변 (1개)

Sebastian Bomberg
Sebastian Bomberg 2019년 10월 22일
You can manually control the color limits of heatmaps:
h = heatmap(__,'ColorLimits',[0 10])

카테고리

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

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by