2014-11-15 8 views
0

x 및 y의 함수 인 두 개의 변수 (z1 및 z2)가 있습니다. 동일한 색상 막대를 사용하여 두 개의 하위 플롯에 음영을 그립니다. 이 두 변수는 최소값과 최대 값이 다릅니다. 그래서 색상 막대를 (z1, z2)의 최소 단위로 시작하고 max (z1, z2) 단위로 끝내기로 정의하고 싶습니다. 그러므로 내가 사용Scilab : 두 개의 서브 플로트에 대해 동일한 색상 막대

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)))); 

그러나이 같은 일을, 나는 그들의 최소 및 최대에 각각 대응하는 그들의 자신의 년 Colorbar를 사용하여 두 개의 그래프를 얻을. 우리는 Matlab에서 caxis 및 clim과 같은 속성을 사용하여이 동작을 얻을 수 있음을 알고 있습니다. 그러나 Scilab의 이러한 속성과 동일한 기능을 알지 못합니다.

Scilab의 기본 버전에서이 작업을 수행 할 수 없다면 Scilab에서 허용하는 라이브러리를 알려줄 수 있습니까?

도움 주셔서 감사합니다.

답변

0

사용한 실제 범위에 따라 (각면의 색상을 정의하는) 컬러 매트릭스를 '직접'에서 '축소'에서 cdata_mapping을 변경하고 확장하려고 수

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); 
+0

안녕하세요 그것은 완벽하게 작동합니다. 감사합니다. – Orime