MATLAB: Colorbar in second subplot

colorbarsubplot

Hi, I have a question about colorbar. When I call 2 and more times my code colorbar seems like
and I don`t have idea why..
My code is there, but when i call it in console its look ok but You can see that second colorbar has bold numbers…its same as my picture, when I call it in gui with different matrix after clicks on the button it looks like in my picture :/
figure;
M = rand([10,16,4],'single');
mmax1 = max(max(M(:,:,1)));
mmin1 = min(min(M(:,:,1)));
mmax2 = max(max(M(:,:,2)));
mmin2 = min(min(M(:,:,2)));
bottom = min(mmin1,mmin2);
top = max(mmax1,mmax2);
vektor1 = [0.17, 0.45, 0.3, 0.2];
vektor2 = [0.65, 0.45, 0.3, 0.2];
vektor3 = [0.17, 0.1, 0.3, 0.2];
scale=[200 600];
scale2 =[200 600];
image = M(:,:,1);
im = imresize(image,scale);
s = subplot(3,2,3);%,'Position',vektor1),


imshow(im)
axis off;
caxis([bottom top]);
set(s,'Position',vektor1);
%c = colorbar;


colormap(jet(round(256)));
freezeColors;
c = cbfreeze(colorbar);
x1=get(gca,'position');
x=get(c,'Position');
x(3)=0.007;
set(c,'Position',x)
set(gca,'position',x1)
image = M(:,:,2);
im = imresize(image,scale);
ss = subplot(3,2,2);
set(ss,'Position',vektor2);
imshow(im);
axis off;
caxis([bottom top]);
colormap(jet(round(256)));
freezeColors;
c = cbfreeze(colorbar);
x1=get(gca,'position');
x=get(c,'Position');
x(3)=0.007;
set(c,'Position',x)
set(gca,'position',x1)
M = rand([10,16,5],'single');
mmax1 = max(max(M(:,:,1)));
mmin1 = min(min(M(:,:,1)));
mmax2 = max(max(M(:,:,2)));
mmin2 = min(min(M(:,:,2)));
bottom = min(mmin1,mmin2);
top = max(mmax1,mmax2);
image = M(:,:,1);
im = imresize(image,scale);
s = subplot(3,2,3);%,'Position',vektor1),
imshow(im)
axis off;
caxis([bottom top]);
set(s,'Position',vektor1);
%c = colorbar;
colormap(jet(round(256)));
freezeColors;
c = cbfreeze(colorbar);
x1=get(gca,'position');
x=get(c,'Position');
x(3)=0.007;
set(c,'Position',x)
set(gca,'position',x1)
image = M(:,:,2);
im = imresize(image,scale);
ss = subplot(3,2,2);
set(ss,'Position',vektor2);
imshow(im);
axis off;
caxis([bottom top]);
colormap(jet(round(256)));
freezeColors;
c = cbfreeze(colorbar);
x1=get(gca,'position');
x=get(c,'Position');
x(3)=0.007;
set(c,'Position',x)
set(gca,'position',x1)
M = rand([10,16,2],'single');
mmax1 = max(max(M(:,:,1)));
mmin1 = min(min(M(:,:,1)));
mmax2 = max(max(M(:,:,2)));
mmin2 = min(min(M(:,:,2)));
bottom = min(mmin1,mmin2);
top = max(mmax1,mmax2);
vektor1 = [0.17, 0.45, 0.3, 0.2];
vektor2 = [0.65, 0.45, 0.3, 0.2];
vektor3 = [0.17, 0.1, 0.3, 0.2];
scale=[200 600];
scale2 =[200 600];
image = M(:,:,1);
im = imresize(image,scale);
s = subplot(3,2,3);%,'Position',vektor1),
imshow(im)
axis off;
caxis([bottom top]);
set(s,'Position',vektor1);
%c = colorbar;
colormap(jet(round(256)));
freezeColors;
c = cbfreeze(colorbar);
x1=get(gca,'position');
x=get(c,'Position');
x(3)=0.007;
set(c,'Position',x)
set(gca,'position',x1)
image = M(:,:,2);
im = imresize(image,scale);
ss = subplot(3,2,2);
set(ss,'Position',vektor2);
imshow(im);
axis off;
caxis([bottom top]);
colormap(jet(round(256)));
freezeColors;
c = cbfreeze(colorbar);
x1=get(gca,'position');
x=get(c,'Position');
x(3)=0.007;
set(c,'Position',x)
set(gca,'position',x1)
EDIT: It seems like that problem is with subplot(3,2,2) not only colorbar.
Sorry for my bad english.

Best Answer

I solved it, I replaced all
s = subplot(3,2,3);%,'Position',vektor1),
set(s,'Position',vektor1);
by
subplot('Position',vektor1),
and it works!