Discussion:
grayplot scaling
Bouchra Bensiali
2010-11-06 22:11:47 UTC
Permalink
Hello,

Is there an equivalent in Scilab to the Matlab caxis Pseudocolor axis scaling? I
want to do something like that:

--
figure,
x = linspace(0,1,101);
z = cos(2*pi*x)'*sin(2*pi*x);
zm = min(min(z)); zM = max(max(z));
pcolor(x,x,z), shading flat,
caxis manual; caxis([zm zM]);
colorbar

figure,
z2 = x'*x*0.4;
pcolor(x,x,z2), shading flat,
caxis manual; caxis([zm zM]);
colorbar
--

Thank your for your help.
Samuel Gougeon
2010-11-07 23:46:35 UTC
Permalink
Hello,
Post by Bouchra Bensiali
Hello,
Is there an equivalent in Scilab to the Matlab caxis Pseudocolor axis scaling? I
.../...
Post by Bouchra Bensiali
caxis manual; caxis([zm zM]); colorbar
I am not a Matlaber, but after watching online Matlab help page
for caxis(), it comes that these 3 instructions are written as
something like

colorbar(zm,zM)

in Scilab

Regards
Samuel
Bouchra Bensiali
2010-11-08 00:54:42 UTC
Permalink
Thank you for the answer, I tried that but finally it seems that there is a
problem when colorbar is used with grayplot, see
http://bugzilla.scilab.org/show_bug.cgi?id=4808. Anyway, the link provides a
solution using Sgrayplot with the zminmax option.

Another solution would be to use the "Matlab-like" Plotting library for Scilab
http://atoms.scilab.org/toolboxes/plotlib/0.42, but I have some problems to plot
graphics in scilab-5.2.2. Can I use the plotlib with scilab-4.1.2?

Thank you.


----- Message d'origine ----
De : Samuel Gougeon <***@univ-lemans.fr>
À : ***@lists.scilab.org
Envoyé le : Lun 8 novembre 2010, 0h 46min 35s
Objet : Re: [scilab-Users] grayplot scaling

Hello,
Post by Bouchra Bensiali
Hello,
Is there an equivalent in Scilab to the Matlab caxis Pseudocolor axis scaling? I
.../...
Post by Bouchra Bensiali
caxis manual; caxis([zm zM]); colorbar
I am not a Matlaber, but after watching online Matlab help page
for caxis(), it comes that these 3 instructions are written as
something like

colorbar(zm,zM)

in Scilab

Regards
Samuel
Stéphane Mottelet
2010-11-08 07:58:02 UTC
Permalink
Hi,

can you give your sample code ?

S.
Post by Bouchra Bensiali
Thank you for the answer, I tried that but finally it seems that there is a
problem when colorbar is used with grayplot, see
http://bugzilla.scilab.org/show_bug.cgi?id=4808. Anyway, the link provides a
solution using Sgrayplot with the zminmax option.
Another solution would be to use the "Matlab-like" Plotting library for Scilab
http://atoms.scilab.org/toolboxes/plotlib/0.42, but I have some problems to plot
graphics in scilab-5.2.2. Can I use the plotlib with scilab-4.1.2?
Thank you.
----- Message d'origine ----
Envoyé le : Lun 8 novembre 2010, 0h 46min 35s
Objet : Re: [scilab-Users] grayplot scaling
Hello,
Post by Bouchra Bensiali
Hello,
Is there an equivalent in Scilab to the Matlab caxis Pseudocolor axis scaling? I
.../...
Post by Bouchra Bensiali
caxis manual; caxis([zm zM]); colorbar
I am not a Matlaber, but after watching online Matlab help page
for caxis(), it comes that these 3 instructions are written as
something like
colorbar(zm,zM)
in Scilab
Regards
Samuel
Stéphane Mottelet
2010-11-08 08:16:02 UTC
Permalink
The code you posted before works out of the box, with Scilab >=5.2
provided you change "pi" by "%pi" and that you enable the plotlib
macro names without underscores :

plotlibmode // done once for all, to be put in your .scilab user startup
file

figure,
x = linspace(0,1,101);
z = cos(2*%pi*x)'*sin(2*%pi*x);
zm = min(min(z)); zM = max(max(z));
pcolor(x,x,z), shading flat,
caxis manual; caxis([zm zM]);
colorbar

figure,
z2 = x'*x*0.4;
pcolor(x,x,z2), shading flat,
caxis manual; caxis([zm zM]);
colorbar

S.
Post by Bouchra Bensiali
Thank you for the answer, I tried that but finally it seems that there is a
problem when colorbar is used with grayplot, see
http://bugzilla.scilab.org/show_bug.cgi?id=4808. Anyway, the link provides a
solution using Sgrayplot with the zminmax option.
Another solution would be to use the "Matlab-like" Plotting library for Scilab
http://atoms.scilab.org/toolboxes/plotlib/0.42, but I have some problems to plot
graphics in scilab-5.2.2. Can I use the plotlib with scilab-4.1.2?
Thank you.
----- Message d'origine ----
Envoyé le : Lun 8 novembre 2010, 0h 46min 35s
Objet : Re: [scilab-Users] grayplot scaling
Hello,
Post by Bouchra Bensiali
Hello,
Is there an equivalent in Scilab to the Matlab caxis Pseudocolor axis scaling? I
.../...
Post by Bouchra Bensiali
caxis manual; caxis([zm zM]); colorbar
I am not a Matlaber, but after watching online Matlab help page
for caxis(), it comes that these 3 instructions are written as
something like
colorbar(zm,zM)
in Scilab
Regards
Samuel
Bouchra Bensiali
2010-11-08 21:14:49 UTC
Permalink
Hello,

Ok, I answered you in the google group
https://groups.google.com/group/comp.soft-sys.math.scilab/browse_thread/thread/bff4a43197e9bcf9?hl=fr

Maybe there is an issue with my graphic card then to use scilab-5.2.2.

Thank you for your help.



----- Message d'origine ----
De : Stéphane Mottelet <***@utc.fr>
À : ***@lists.scilab.org
Envoyé le : Lun 8 novembre 2010, 9h 16min 02s
Objet : Re: [scilab-Users] Re : [scilab-Users] grayplot scaling

The code you posted before works out of the box, with Scilab >=5.2
provided you change "pi" by "%pi" and that you enable the plotlib
macro names without underscores :

plotlibmode // done once for all, to be put in your .scilab user startup
file

figure,
x = linspace(0,1,101);
z = cos(2*%pi*x)'*sin(2*%pi*x);
zm = min(min(z)); zM = max(max(z));
pcolor(x,x,z), shading flat,
caxis manual; caxis([zm zM]);
colorbar

figure,
z2 = x'*x*0.4;
pcolor(x,x,z2), shading flat,
caxis manual; caxis([zm zM]);
colorbar

S.
Post by Bouchra Bensiali
Thank you for the answer, I tried that but finally it seems that there is a
problem when colorbar is used with grayplot, see
http://bugzilla.scilab.org/show_bug.cgi?id=4808. Anyway, the link provides a
solution using Sgrayplot with the zminmax option.
Another solution would be to use the "Matlab-like" Plotting library for Scilab
http://atoms.scilab.org/toolboxes/plotlib/0.42, but I have some problems to plot
graphics in scilab-5.2.2. Can I use the plotlib with scilab-4.1.2?
Thank you.
----- Message d'origine ----
Envoyé le : Lun 8 novembre 2010, 0h 46min 35s
Objet : Re: [scilab-Users] grayplot scaling
Hello,
Post by Bouchra Bensiali
Hello,
Is there an equivalent in Scilab to the Matlab caxis Pseudocolor axis
scaling?
Post by Bouchra Bensiali
Post by Bouchra Bensiali
I
.../...
Post by Bouchra Bensiali
caxis manual; caxis([zm zM]); colorbar
I am not a Matlaber, but after watching online Matlab help page
for caxis(), it comes that these 3 instructions are written as
something like
colorbar(zm,zM)
in Scilab
Regards
Samuel
Samuel GOUGEON
2010-11-08 17:13:14 UTC
Permalink
----- Message d'origine -----
De : Bouchra Bensiali
Post by Bouchra Bensiali
Thank you for the answer, I tried that but finally it seems that there is a
problem when colorbar is used with grayplot, see
http://bugzilla.scilab.org/show_bug.cgi?id=4808.
There is no problem: If really needed, data scaling should be done by hand,
instead of via an
option. But the most intuitive way is to scale the colorbar to data, instead of the
opposite, and it works.

Samuel
Stéphane Mottelet
2010-11-08 17:23:57 UTC
Permalink
Post by Samuel GOUGEON
----- Message d'origine -----
De : Bouchra Bensiali
Post by Bouchra Bensiali
Thank you for the answer, I tried that but finally it seems that there is a
problem when colorbar is used with grayplot, see
http://bugzilla.scilab.org/show_bug.cgi?id=4808.
There is no problem: If really needed, data scaling should be done by
hand, instead of via an
option. But the most intuitive way is to scale the colorbar to data, instead of the
opposite, and it works.
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.
Post by Samuel GOUGEON
Samuel
Samuel GOUGEON
2010-11-08 18:14:13 UTC
Permalink
----- 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
Bouchra Bensiali
2010-11-08 20:55:02 UTC
Permalink
Hello 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. And 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".

I tried the following:
--
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 ----
De : Samuel GOUGEON <***@univ-lemans.fr>
À : ***@lists.scilab.org
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
2010-11-08 21:38:31 UTC
Permalink
Post by Bouchra Bensiali
Hello 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.
To get the same colorscale on several images, I tend to use contourf
instead of grayplot.
I have an example at work, I'll post it here tomorrow.
BTW, is it just me or scilab.org is down?

Antoine
Post by Bouchra Bensiali
And 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
2010-11-09 08:54:44 UTC
Permalink
Post by Bouchra Bensiali
Hello 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 Bensiali
And 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

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Bouchra Bensiali
2010-11-09 19:03:13 UTC
Permalink
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 Bensiali
Hello 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 Bensiali
And 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

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Stephane Mottelet
2010-11-09 19:23:17 UTC
Permalink
Hi,

you can also use the plotlib 0.21 (the last version working
with Scilab 4 branch) and Scilab 4.2.1. I did
not propose this solution because versions <= 0.4 do not
completely respect the straight Matlab syntax. However,
your example should work written like this (issue the caxis
command before plotting) :

figure,
x = linspace(0,1,101);
z = cos(2*%pi*x)'*sin(2*%pi*x);
zm = min(min(z)); zM = max(max(z));
caxis([zm zM]);
pcolor(x,x,z);
shading flat,
colorbar

figure,
z2 = x'*x*0.4;
caxis([zm zM]);
pcolor(x,x,z2), shading flat,
colorbar

S.
Post by Bouchra Bensiali
Thank you, it works!
- 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 ----
Envoyé le : Mar 9 novembre 2010, 9h 54min 44s
Objet : Re: [scilab-Users] Re : [scilab-Users] Re : [scilab-Users] grayplot
scaling
Post by Bouchra Bensiali
Hello and thank you for your answers.
Yes, the context is to use a common color scale among several images, excuse
it
Post by Bouchra Bensiali
wasn't clear in my first message.
///////////////////////////////////////////////////////////////////////////////////////////
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 Bensiali
And another use would be for animation, as
said in the bugzilla link, "zminmax option is important for
animation to have
a
Post by Bouchra Bensiali
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
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Stephane Mottelet
2010-11-09 19:26:31 UTC
Permalink
Hi all,

Is there an issue concerning the compatibility of
Mobile Intel(R) 4 Series Express Chipset Family.
with Scilab 5 family ?

S.
Calixte Denizet
2010-11-09 19:35:31 UTC
Permalink
Post by Stephane Mottelet
Hi all,
Hello Stephane,
Post by Stephane Mottelet
Is there an issue concerning the compatibility of
Mobile Intel(R) 4 Series Express Chipset Family.
with Scilab 5 family ?
It would seem...:

http://bugzilla.scilab.org/show_bug.cgi?id=8344

where JB proposed a workaround.

Calixte
Post by Stephane Mottelet
S.
alain
2010-11-09 19:46:06 UTC
Permalink
Hello!

I'm building an graphic user interface using uicontrol widgets under
Scilab 5.2.2, for linux and windows users. The way to call some code
when the widget is clicked is to provide a callback function. This does
work fine, except when I want to process a big set of data on a button
click, my graphic interface is then slow down and sometimes crash...

Is there any way to launch a independant process in scilab (from a
callback for example)?

Thanks!

Loading...