function h=mycolorbar(h,colorm)
if nargin<2;colorm = colormap;end
if nargin==0;h=colorbar;end
C = colormap(colorm);
nc = length(C);

limit = h.Limits;
tics = h.Ticks;
%limits = [tics(1) tics(end)];
df = diff(tics);%df = df(1);

nvec = linspace(limit(1),limit(2),nc);
ovec = [tics(1)+df(1)/2,tics(1)+df(1)/2+cumsum(df(1:end-1))];
ovec = ovec(ovec>limit(1)&ovec<limit(2));
mapa1 = interp1(nvec,C,ovec); 

colormap(mapa1);
pos = h.Position;
h.TickLength = pos(3);  %FOR VERTICAL
%h.TickLength = pos(4);  %FOR HORIZONTAL
return