Color bar size including tags in Matlab R2014b

How to find out how much space a color bar takes with Matlab R2014b? I need to know the total size, including all the labels, but if I do

c = colorbar;
get(c,'TightInset');

I get an error

Error using matlab.graphics.illustration.ColorBar / get
The ColorBar class does not have a TightInset property.

The same is true for OuterPosition. Apparently, these properties are no longer supported for the ColorBar class in R2014b.

+4
source share
1 answer

Try:

original = get(c, 'Position')
set(c, 'Position', [original(1) original(2)*0.5, original(3), original(4)*0.5])

c 'Position', , . , . , colorbar, :

set(get(c, 'YLabel'), 'String', {'a', 'b', 'c'})     % Arbitrary Labels
set(get(c, 'Title'), 'String', {'Colorbar Title'});  % Arbitrary Title
set(c, 'Position', [original])                       % Resize back to original and observe!
0

All Articles