image thumbnail
from MATLAB Plot Gallery - Using Colorbars (2) by Plot Gallery
Add a horizontal colorbar

Add_Colorbar_to_Plot_2

This is an example of how to add a horizontal colorbar to a plot in MATLAB®.

Read about the colorbar function in the MATLAB® documentation.

Go to MATLAB Plot Gallery

% Load spine data
load spine X;

% Create an image plot of the spine data
figure;
imagesc(X);
colormap bone;

% Add a horizontal colorbar to the bottom of the plot
colorbar('SouthOutside');
axis square;

Contact us