Reputation: 951
I am trying to have colorbar with specific range. I tried the following
h = colorbar();
set(h, 'ylim', [0 60]);
I would like to have the highest value color in 40 to be in 60 in the colorbar (stretching for the colors range), and the color in value 40 in colorbar should be the maximum value in the figure.
Upvotes: 1
Views: 1044
Reputation: 26069
Before colorbar
use the function caxis
with the limits you want, for example,
surf(meshgrid(0:7).^2)
caxis([0, 60])
colorbar
Upvotes: 2