File Exchange

image thumbnail

Fake Colorbar

version 1.0.0.0 (1.2 KB) by Sally Warner
Make the x-axes of subplots align when one has a colorbar and one does not.

1 Download

Updated 27 Sep 2013

View License

Often I want to plot two (or many) datasets that have the same time vector. I simply use the SUBPLOT command in MATLAB to do so. A problem arises, however, when one of these datasets happens to be three-dimensional — something that I want to plot with pcolor. When I add a colorbar to that subplot, the time-axis (x-axis) no longer lines up with the other subplots.

To fix this problem, I wrote this simple function called FAKECOLORBAR which changes the size of the subplots that do not require colorbars so they match the subplots with colorbars.

Cite As

Sally Warner (2021). Fake Colorbar (https://www.mathworks.com/matlabcentral/fileexchange/43660-fake-colorbar), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Alison Macdonald

Excellent! I am always needing this and have too many hours rearranging the size of subplots to fit and match - I'll download now and give it a try.

Simon Schegg

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!