slim_colorbar(varargin)
SLIM_COLORBAR Display color bar (color scale)
Just like matlab colorbar but it keeps the size of the associated axes
unchanged and allows user to specify the width of colorbar.
USAGE:
slim_colorbar
slim_colorbar(width)
slim_colorbar(width, ax_acc)
[ ax_c ] = slim_colorbar(...)
ARGUMENTS (optional):
width -- width of colorbar (% of figure width, suggest 0.01)
ax_acc -- the associated axes (the default is the current one)
OUTPUT:
ax_c -- axes handle of the colorbar
EXAMPLE:
{
figure('NumberTitle','Off','Name','Slim colorbar','color','w');
subplot(2,2,1);
plot(1:10);
subplot(2,2,3);
plot(1:10);
xlabel('Matlab colorbar')
colorbar
subplot(2,2,2);
plot(1:10);
ax_acc = subplot(2,2,4);
plot(1:10);
xlabel('Slim colorbar')
slim_colorbar(0.01, ax_acc);
% or slim_colorbar(0.01)
% or simply slim_colorbar;
}
Cite As
Yifan Gu (2025). slim_colorbar(varargin) (https://www.mathworks.com/matlabcentral/fileexchange/61455-slim_colorbar-varargin), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Graphics > Formatting and Annotation > Axes Appearance > Combine Multiple Plots > Subplots >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.