MATLAB: I am getting a colorbar with uniform color. I want there to be variations so the distribution makes sense.

colorbarcontourimageimshow

The P matrix varies from 1 to 2, however the returned figure shows one square with one uniform color. it would be a great help, if i could have a range of colors in that range(1 to 2) to show the distribution.
imshow(P,'InitialMagnification',2000)
colb = colorbar;
set(colb, 'ylim', [1 2])

Best Answer

imshow(P, [], 'InitialMagnification',2000)