fh = gcf();
axh = findall(fh, 'Type','Axes');
cbh = findall(fh, 'Type','ColorBar');
ax2 = axes('position',cbh.Position,'XTick',[],'YTick',[],'Box','on');
ax2.Position(1) = ax2.Position(1) - .01;
ax2.Position(2) = ax2.Position(2) - .01;
ax2.Position(3) = ax2.Position(3)*4;
ax2.Position(4) = 1 - ax2.Position(2) - .01;
ax2.Colormap = axh.Colormap;
ax2.ColorScale = axh.ColorScale;
cb2 = colorbar(ax2);
cb2.Position = cbh.Position;
cb2.FontSize = cbh.FontSize;
cb2.Limits = cbh.Limits;
cb2.LimitsMode = cbh.LimitsMode;
cb2.TickDirection = cbh.TickDirection;
cb2.YAxisLocation = cbh.YAxisLocation;
caxis(ax2,cbh.Limits)
th = title(cb2,cbh.Title.String,'Units','Normalize');
th.Position(1) = th.Position(1) - min(0,th.Extent(1)-.00);
ax2.Color = [1 1 1 .6];
cbh.Visible = 'off';
Best Answer