如何在matlab输出中的标签上添加标题?

Pra*_*rma 7 matlab

我的程序的输出是一个区域图,并且有一个图的标题但我想在颜色栏上也标题.我搜索了很多功能,但我无法做到这一点.谁能帮我 ??

Pet*_*ete 15

使用colorbar的句柄输出相对容易:

imagesc(randn(10));
h = colorbar;
title(h,'my colorbar')
Run Code Online (Sandbox Code Playgroud)


OSE*_*OSE 7

除了Pete的优秀答案之外,如果你想在标签旁边colorbar使用这个:

[X,Y,Z] = peaks;
figure;
contourf(X,Y,Z,20);
h = colorbar;
ylabel(h,'Side colorbar label');
Run Code Online (Sandbox Code Playgroud)