The output of my program is an area plot and there is a title of the figure But I want to put a title on the colorbar also. i have searched many functions but I am not able to do this. can anyone help me ??
Create Title and SubtitleCreate a plot. Then create a title and a subtitle by calling the title function with two character vectors as arguments. Use the 'Color' name-value pair argument to customize the color for both lines of text. Specify two return arguments to store the text objects for the title and subtitle.
colorbar( target ,___) adds a colorbar to the axes or chart specified by target . Specify the target axes or chart as the first argument in any of the previous syntaxes. c = colorbar(___) returns the ColorBar object. You can use this object to set properties after creating the colorbar.
This is relatively easy to do using the handle output from colorbar:
imagesc(randn(10));
h = colorbar;
title(h,'my colorbar')
In addition to Pete's excellent answer, if you want a label on the side of the colorbar
use this:
[X,Y,Z] = peaks;
figure;
contourf(X,Y,Z,20);
h = colorbar;
ylabel(h,'Side colorbar label');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With