开发者

How can I change colormap of trisurf plot to better differentiate positive/negative values

开发者 https://www.devze.com 2023-01-20 18:01 出处:网络
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 ar开发者_开发

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 ar开发者_开发知识库e 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

How can I change colormap of trisurf plot to better differentiate positive/negative values

0

精彩评论

暂无评论...
验证码 换一张
取 消