那这个呢:
colorbar
axis off
Run Code Online (Sandbox Code Playgroud)
如果您想完全控制颜色条的宽度和位置,那么您可以执行以下操作:
fig1=figure;
left=100; bottom=100 ; width=20 ; height=500;
pos=[left bottom width height];
axis off
colorbar([0.1 0.1 0.7 0.8]);
set(fig1,'OuterPosition',pos)
Run Code Online (Sandbox Code Playgroud)