MATLAB Examples

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.

For more examples, 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