Thank you, it works!
So if I summarize the different solutions :
- use of Sgrayplot with the zminmax option
http://bugzilla.scilab.org/show_bug.cgi?id=4808#c1
- use of Matlab syntax with the caxis command and the "Matlab-like" Plotting
library for Scilab http://atoms.scilab.org/toolboxes/plotlib/0.42 (doesn't work
for me because I have problems when plotting graphics with scilab-5.2.2...)
- rescaling of data http://bugzilla.scilab.org/show_bug.cgi?id=4808#c3 (doesn't
work for me, I surely missed something...)
- use of contourf with color levels
Thanks.
----- Message d'origine ----
De : Antoine Monmayrant <***@laas.fr>
À : ***@lists.scilab.org
Envoyé le : Mar 9 novembre 2010, 9h 54min 44s
Objet : Re: [scilab-Users] Re : [scilab-Users] Re : [scilab-Users] grayplot
scaling
Post by Bouchra BensialiHello and thank you for your answers.
Yes, the context is to use a common color scale among several images, excuse it
wasn't clear in my first message.
As promised yesterday, here is short example on how I do it using contourf:
///////////////////////////////////////////////////////////////////////////////////////////
y=linspace(-10,10,100);
x=linspace(-15,15,200)';
//two 2D maps with different max/min
z1=cos(x*y/10);
z2=0.5*cos(x*y/10);
//# of colors to use
n_color=128;
// max and min of the color scale
zmin=-1.1;
zmax=1.1;
// levels of the color scale
color_levels=linspace(zmin,zmax,n_color);
h=scf();
h.color_map=hotcolormap(n_color);
subplot(121)
contourf(x,y,z1,color_levels);
subplot(122)
contourf(x,y,z2,color_levels);
colorbar(zmin,zmax);
///////////////////////////////////////////////////////////////////////////////////////////
I know that colorbar is screwing my layout, but I usually don't use it.
I prefer plotting a dummy 1xn_color map with custom axis and layout.
Hope it helps,
Antoine
Post by Bouchra BensialiAnd another use would be for animation, as
said in the bugzilla link, "zminmax option is important for animation to have a
colorbar scale which is not changing from frame to frame".
--
x = linspace(0,1,101);
z = cos(2*%pi*x)'*sin(2*%pi*x);
zm = min(z); zM = max(z);
xset("window",1)
xset("colormap",jetcolormap(64))
colorbar(zm,zM)
grayplot(x,x,z)
z2 = x'*x*0.4;
xset("window",2)
xset("colormap",jetcolormap(64))
colorbar(zm,zM)
grayplot(x,x,z2)
e = gce(); m = e.data.z;
e.data.z = zm+(m-min(m))/(max(m)-min(m))*(zM-zm);
--
but it doesn't work for me, am I doing something wrong?
Thanks.
----- Message d'origine ----
Envoyé le : Lun 8 novembre 2010, 19h 14min 13s
Objet : [scilab-Users] Re : [scilab-Users] grayplot scaling
----- Message d'origine -----
De : Stéphane Mottelet
What is requested by Bouchra is as intuitive as wanting to change axis limits
to easily compare two plots. This feature (caxis stuff) is really missing in
Scilab graphics.
S.
For instance to use and share the same colorbar for several plots?
Would the following be a work-around?
http://bugzilla.scilab.org/show_bug.cgi?id=4808#c3
--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Antoine Monmayrant LAAS - CNRS
7 avenue du Colonel Roche
31077 TOULOUSE
Cedex 4 FRANCE
Tel:+33 5 61 33 64 59
email : ***@laas.fr
permanent email : ***@polytechnique.org
+++++++++++++++++++++++++++++++++++++++++++++++++++++++