Matlab Scilab:两个子批次的颜色相同

Matlab Scilab:两个子批次的颜色相同,matlab,scilab,colorbar,surface,Matlab,Scilab,Colorbar,Surface,我有两个变量(z1和z2),它们是x和y的函数。 我想用相同的色条将它们绘制在两个子图中。 这两个变量具有不同的最小值和最大值。 因此,我想将颜色条定义为以最小值(z1,z2)开始,以最大值(z1,z2)结束。 因此,我使用: figure=scf(); figure.color_map=jetcolormap(32); subplot1=subplot(121); surf(x,y,z1); subplot2=subplot(122); surf(x,y,z2); colorbar(min(m

我有两个变量(z1和z2),它们是x和y的函数。 我想用相同的色条将它们绘制在两个子图中。 这两个变量具有不同的最小值和最大值。 因此,我想将颜色条定义为以最小值(z1,z2)开始,以最大值(z1,z2)结束。 因此,我使用:

figure=scf();
figure.color_map=jetcolormap(32);
subplot1=subplot(121);
surf(x,y,z1);
subplot2=subplot(122);
surf(x,y,z2);
colorbar(min(min(min(z1)),min(min(z2))),max(max(max(z1)),max(max(z2))));
但这样做的话,我得到了两个使用他们自己的颜色条的图,分别对应于他们的最小值和最大值。 我知道,我们可以在Matlab上使用caxis和clim等属性获得这种行为。但我不知道Scilab的这些属性的等价物

如果无法使用基本版本的Scilab执行此操作,请您向我建议一些Scilab允许执行此操作的库


感谢您的帮助。

您可以尝试将cdata\u映射从“缩放”更改为“直接”,并根据实际使用的范围缩放颜色矩阵(定义每个面的颜色):

x=[0:0.3:2*%pi];   //example data
[X,Y]=ndgrid(x,x);
Z1=sin(x')*cos(x);    //first data set
Z2=Z1./2;    //second dataset is half in amplitude

Zmin=min(min(Z1),min(Z2));    //Absolut minimum of all data sets
Zmax=max(max(Z1),max(Z2));    //Absolut maximum of all data sets
nc=100;   //number of colors in colormap

tabl=scf();
tabl.color_map=jetcolormap(nc);
subplot(1,2,1);
surf(X,Y,Z1);
h=gce();
cm=h.data.color;   //color matrix
h.data.color=((cm-Zmin)./(Zmax-Zmin)).*(nc-1)+1;   //scale color matrix & convert to color number
h.cdata_mapping="direct";   //change color mapping from 'scaled' to 'direct'
colorbar(Zmin,Zmax);

subplot(1,2,2);
surf(X,Y,Z2);
h=gce();
cm=h.data.color;   //color matrix
h.data.color=((cm-Zmin)./(Zmax-Zmin)).*(nc-1)+1;   //scale color matrix & convert to color number
h.cdata_mapping="direct";   //change color mapping from 'scaled' to 'direct'
colorbar(Zmin,Zmax);