在MATLAB R2014b中设置颜色条的Alpha [英] Setting alpha of colorbar in MATLAB R2014b

查看:326
本文介绍了在MATLAB R2014b中设置颜色条的Alpha的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带alpha贴图的色图(来自imagesc)。我希望颜色栏反映Alpha(请注意,颜色图下方的图像是相同的)。我在网上找到了解决方案,但似乎没有在R2014b中工作。

I have a colorplot (from imagesc) with an alpha map. I'd like the colorbar to reflect the alpha (notice that in the image below the colormaps are the same). I found solutions online but none seem to work in R2014b.

代码在这里:

subplot(2,1,1)
A = imagesc(meshgrid(0:10,0:5));
alpha(A,1)
colorbar

subplot(2,1,2)
B = imagesc(meshgrid(0:10,0:5));
alpha(B,.7)
colorbar

James

推荐答案

您可以在颜色栏顶部添加一个带有alpha的文本框。

You could add a textbox with alpha on top of the colorbar. This works for later versions of MATLAB.

cb=colorbar

annotation('textbox',...
    cb.Position,...
    'FitBoxToText','off',...
    'FaceAlpha',0.5,...
    'EdgeColor',[1 1 1],...
    'BackgroundColor',[1 1 1]);

这篇关于在MATLAB R2014b中设置颜色条的Alpha的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆