Matlab-两个子图,单个色标和颜色条 [英] Matlab - Two Subplots, single color scale and colorbar

查看:1044
本文介绍了Matlab-两个子图,单个色标和颜色条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑以下代码

x = [-1:0.1:1];
subplot(2,2,1)
imagesc(x,x,abs(x)/100)
colorbar
subplot(2,2,2)
imagesc(x,x,abs(x))
colorbar

我要发生的事情是两张图片将使用相同的色标,并且使用相同的颜色条,即左侧大部分为蓝色,而右侧则为完整规模.

What I want to happen Is that both images will be on the same color scale, and the same color bar I.e., that the left will be mostly blue, while the right one will show the full scale.

推荐答案

使范围都适合.

x = [-1:0.1:1];

subplot(1,2,2)
imagesc(x,x,abs(x))
colorbar
c2 = caxis;

subplot(1,2,1)
imagesc(x,x,abs(x)/100)
colorbar
c1 = caxis;
c3 = [min([c1 c2]), max([c1 c2])];
caxis(c3)

subplot(1,2,2)
colorbar off

这篇关于Matlab-两个子图,单个色标和颜色条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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