本文介绍了Matlab R2014b中包含标签的颜色条的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何找出使用Matlab R2014b占用彩条的空间?我需要知道包括所有标签的总尺寸,但是如果我知道
How do I find out how much space a color bar takes up using Matlab R2014b? I need to know the total size including all labels, but if I do
c = colorbar;
get(c,'TightInset');
我收到错误消息
OuterPosition也是如此.显然,R2014b中的ColorBar类不再支持这些属性.
The same holds for OuterPosition. Apparently, these properties are no longer supported for the ColorBar class in R2014b.
推荐答案
尝试:
original = get(c, 'Position')
set(c, 'Position', [original(1) original(2)*0.5, original(3), original(4)*0.5])
句柄c包含一个'Position'属性,与许多图形句柄相同.查找文档以更全面地了解它.要验证这是否也转换了颜色条标题和标签的位置,请执行以下操作:
The handle c contains a 'Position' property, same as many graphics handles. Look up the documentation to understand it more fully. To verify that this translates the position of colorbar title and labels too, execute the following:
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!
这篇关于Matlab R2014b中包含标签的颜色条的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!