如何更改Trisurf图的颜色图以更好地区分正/负值 [英] How can I change colormap of trisurf plot to better differentiate positive/negative values

查看:85
本文介绍了如何更改Trisurf图的颜色图以更好地区分正/负值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个trisurf图,该图在零以上.如何更改颜色图,以便我进行颜色编码,以使表面上大于零的部分为蓝色,而小于零的部分为红色?

I have a trisurf plot that goes above and below zero. How do I change the colormap such that I color code so that portions of the surface greater than zero are blue and portions below zero are red?

推荐答案

您可以自己构建这样的颜色图.举个例子:

You can build such a colormap yourself. Take this example:

r = [1 0 0];       %# start
w = [.9 .9 .9];    %# middle
b = [0 0 1];       %# end

%# colormap of size 64-by-3, ranging from red -> white -> blue
c1 = zeros(32,3); c2 = zeros(32,3);
for i=1:3
    c1(:,i) = linspace(r(i), w(i), 32);
    c2(:,i) = linspace(w(i), b(i), 32);
end
c = [c1(1:end-1,:);c2];

surf(peaks), shading interp
caxis([-8 8]), colormap(c), colorbar

这篇关于如何更改Trisurf图的颜色图以更好地区分正/负值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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