BIOSCILAB
SCILAB 4.0 PAS-A-PAS
SCILAB 4.0 STEP-BY-STEP

Jacques-Deric Rouault

CNRS / INRIA

Volume 4   LE GRAPHISME
Volume 4   GRAPHISM
4.22 GESTION DES REPERES
4.22
MANAGING THE SYSTEMS OF AXES

Version 4.0.19 du 23 Décembre 2005 / Version 4.0.19, December 23th 2005
Scilab 3.1 - Scilab 4.0 /  Windows - Linux

4.21       LE HANDLE FIGURE  / THE HANDLE FIGURE
ALLER A L'INDEX GENERAL / GO TO THE GENERAL INDEX
ALLER A LA TABLE GENERALE / GO TO THE GENERAL TABLE
 4.23       LE HANDLE AXES  / THE HANDLE AXES

4.22.01   Principe  / Principle
4.22.02   Création d'un repère  / Creating a system of axes
4.22.03   Création  contextuelle  / Contextual creation
4.22.09   Création d'un nouveau repère  / Creating a new system of axes
4.22.10   Création de plusieurs repères  / Creating several systems of axes
4.22.11   Changer le repère courant  / Changing the current systems of axes
4.22.12   Recherche des handles  / Searching handles

4.22.01   Principe  / Principle

Le repère ou système d'axes assure la conversion des coordonnées logiques formelles aux coordonnées physiques réelles de la fenetre.
The system of axes provides the conversion of the formal logical coordinates into the real physical coodinates of the window.

Une fenetre graphique peut contenir un un ou plusieurs repères.
A graphic windows has one or more systems of axes.

4.22.02   Création d'un repère  / Creating a system of axes

Quand une fenetre est crée, un repère est automatiquement associé.
When a window is created, a system of axes is automatically associated.

Le repère est l'enfant de la fenetre graphique.
The system of axes is the children of the graphic window.

//  Program Spas42202A
//  Designed for Scilab 3.1 & 4.0
//  Copyright Jacques-Deric Rouault, CNRS, INRIA

disp ("4.22.02A");
hf = scf (1);
hf.figure_name = "4.22.02A";
ha = hf.children (1);

Télécharger le fichier / Download the file Spas42202A.sce

//  Program Spas42202B
//  Designed for Scilab 3.1 & 4.0
//  Copyright Jacques-Deric Rouault, CNRS, INRIA

disp ("4.22.02B");
hf = scf (1);
hf.figure_name = "4.22.02B";
ha = gca ();


Télécharger le fichier / Download the file Spas42202B.sce

4.22.03   Création contextuelle  / Contextual creation

Quand un objet graphique est crée alors qu'aucune fenetre graphique n'est ouverte, une fenetre graphique est crée et le repère est l'enfant de la Figure et le parent de l'objet graphique.
When a graphic object is created when no graphic window is open, a graphic window is created and the system of axes is the child(ren) of the Figure and the parent of the graphic objet.

//  Program Spas42203A
//  Designed for Scilab 3.1 & 4.0
//  Copyright Jacques-Deric Rouault, CNRS, INRIA

disp ("4.22.03A");
xrect (0, 1, 1, 1);
hr = gce ();
ha = gca ();

Télécharger le fichier / Download the file Spas42203A.sce

4.22.09   Création d'un nouveau repère  / Creating a new system of axes

newaxes

La procédure newaxes permet de créer  un nouveau repère dans une même fenetre graphique.
The procedure newaxes simultaneously createsa new system of axes in the same graphic window.

On indiquera ensuite sa position dans le premier repère (ou le repère courant) en affectant au champ axes_bounds la position de l'origine (xinf, yinf), la largeur et la hauteur
Its location in the first system of axes (ot the current system of axes)  is indicated by the place of the origin (xinf, yinf), the width and height.

//  Program Spas42209A
//  Designed for Scilab 4.0
//  Copyright Jacques-Deric Rouault, CNRS, INRIA

disp ("4.22.09A");
hf = scf (1);
hf.figure_name = "4.22.09A";
ha1 = gca ();
ha1.axes_visible = "on";
ha2=newaxes ();
ha2.axes_bounds = [0.2,0.2,0.6,0.6];
ha2.axes_visible = "on";

Télécharger le fichier / Download the file Spas42209A.sce





Ce nouveau repère devient le repère courant.
This new system of axes becomes the current system of axes.

//  Program Spas42209B
//  Designed for Scilab 4.0
//  Copyright Jacques-Deric Rouault, CNRS, INRIA

disp ("4.22.09B");
hf = scf (1);
hf.figure_name = "4.22.09A";
ha1 = gca ();
ha1.axes_visible = "on";
xrect (0.1, 0.9, 0.8, 0.8);

ha2=newaxes ();
ha2.axes_bounds = [0.2,0.2,0.6,0.6];
ha2.axes_visible = "on";
xrect (0.1, 0.9, 0.8, 0.8);

Télécharger le fichier / Download the file Spas42209B.sce





4.22.10   Création de plusieurs repères  / Creating several systems of axes

subplot

La procédure subplot permet de créer simultanément plusieurs repères dans une même fenetre graphique.
The procedure subplot simultaneously creates several systems of axes in the same graphic window.

On indique le nombre de repères par ligne, le nombre de lignes de repères et le rang du repère courant.
The arguments are the number of systems of axes per line, the number of systems of axes and the rank of the current system of axes.

NB : Avec la version 4.0, la procédure subplot est en voie d'obsolescence. Utiliser newaxes pour créer de nouveaux repères.
NOTE: With the version 4.0, the procedure subplot becomes onsolete. Use newaxes to create new systems of axes..

//  Program Spas42210A
//  Designed for Scilab 3.1 & 4.0
//  Copyright Jacques-Deric Rouault, CNRS, INRIA

disp ("4.22.10A");
hf = scf (1);
hf.figure_name = "4.22.10A";
ha = gca ();
ha.axes_visible = "on";
xpause (5000000);
subplot (2, 3, 2);

Télécharger le fichier / Download the file Spas42210A.sce



Nous avons 3 repères par ligne, et deux lignes de repères, soit 6 repères en tout. Le repère courant est le second, compté ligne à ligne. 
We have 3 systems of axes per line, and two lines of systems of axes, then 6 systems of axes. The current system of axes is the second one, counted line per line.

L'argument (2, 3, 3) peut être noté (233).
The argument (2, 3, 3) can be noted (233).

//  Program Spas42210B
//  Designed for Scilab 3.1 & 4.0
//  Copyright Jacques-Deric Rouault, CNRS, INRIA

disp ("4.22.10B");
hf = scf (1);
hf.figure_name = "4.22.10B";
ha = gca ();
ha.axes_visible = "on";
xpause (5000000);
subplot (233);

Télécharger le fichier / Download the file Spas42210B.sce



4.22.11   Changer le repère courant  / Changing the current systems of axes

subplot

On réutilise la procédure subplot en changeant la valeur du 3e argument..
The procedure subplot is reused in changing the value of the third argument.

On indique le nombre de repères par ligne, le nombre de lignes de repères et le rang du repère courant.
The arguments are the number of systems of axes per line, the number of systems of axes and the rank of the current system of axes.

//  Program Spas42211A
//  Designed for Scilab 3.1 & 4.0
//  Copyright Jacques-Deric Rouault, CNRS, INRIA

disp ("4.22.11A");
hf = scf (1);
hf.figure_name = "4.22.11A";

subplot (2, 3, 1);
ha1 = gce ();
ha1.axes_visible = "on";
ha1.foreground = 2;
xfrect (0.2, 0.8, 0.6, 0.6);

subplot (2, 3, 2);
ha2 = gce ();
ha2.axes_visible = "on";
ha2.foreground = 3;
xfrect (0.2, 0.8, 0.6, 0.6);

subplot (2, 3, 3);
ha3 = gce ();
ha3.axes_visible = "on";
ha3.foreground = 4;
xfrect (0.2, 0.8, 0.6, 0.6);

subplot (2, 3, 4);
ha4 = gce ();
ha4.axes_visible = "on";
ha4.foreground = 5;
xfrect (0.2, 0.8, 0.6, 0.6);

subplot (2, 3, 5);
ha5 = gce ();
ha5.axes_visible = "on";
ha5.foreground = 6;
xfrect (0.2, 0.8, 0.6, 0.6);

subplot (2, 3, 6);
ha6 = gce ();
ha6.axes_visible = "on";
ha6.foreground = 7;
xfrect (0.2, 0.8, 0.6, 0.6);

Télécharger le fichier / Download the file Spas42211A.sce



Un repère devient le repère courant quand on active son handle, en affectant une valeur à l'un des ses champs.
A system of axes becomes the current system of axes when its handle is activated, by assigning a value to one of its fields.

La synchronisation des différents repères est controlée par le champ Figure.rotation_style. Voir 4.21.51   rotation_style.
The synchronization if the different system of axes is controled by the field Figure.rotation_style. See 4.21.51   rotation_style.

4.22.12   Recherche des handles  / Searching handles

NB : Avec la version 4.0, la procédure subplot est en voie d'obsolescence. Utiliser newaxes pour créer de nouveaux repères.
NOTE: With the version 4.0, the procedure subplot becomes onsolete. Use newaxes to create new systems of axes.

Avec Scilab 3.1, après l'exécution de subplot, le handle de la fenetre adresse deux enfants :
With Scilab 3.1, after running subplot, the handle of the window adresses two children:

Le premier, hf.children (1) se rapporte au repère courant de la matrice de repères.
The first one, hf.children (1) is the current system of axes of the matrix of systems of axes.
.
Le second, hf.children (2) se rapporte au repère initial unique de la fenetre.
The second one, hf.children (2) is the initial unique system of axes of the window.
.
//  Program Spas42212A
//  Designed for Scilab 3.1
//  Copyright Jacques-Deric Rouault, CNRS, INRIA

disp ("4.22.12A");
hf = scf (1);
hf.figure_name = "4.22.12A";
hf.background = 15;
subplot (2, 3, 1);
ha1 = hf.children(1);
ha1.axes_visible = "on";
ha2 = hf.children (2);
ha2.box = "on";

Télécharger le fichier / Download the file Spas42212A.sce



Pour avoir tous les handles des repères générés par subplot, on fera tourner le repère courant avec subplot et on récupérera à chaque fois le premier handle enfant de la fenetre.
In order to get all the handles generated by subplot, a way consists in making turning the current system of axes with subplot and in getting each time the first children of the window.

//  Program Spas42212B
//  Designed for Scilab 3.1
//  Copyright Jacques-Deric Rouault, CNRS, INRIA

disp ("4.22.12B");
hf = scf (1);
hf.figure_name = "4.22.12B";
hf.background = 23;
ha0 = gca ();
ha0.background = 23;

subplot (2, 3, 1);
ha1 = gce();
ha1.axes_visible = "on";
ha1.background = 2;

subplot (2, 3, 2);
ha2 = gce ();
ha2.axes_visible = "on";
ha2.background = 3;

subplot (2, 3, 3);
ha3 = gce ();
ha3.axes_visible = "on";
ha3.background = 4;

subplot (2, 3, 4);
ha4 = gce ();
ha4.axes_visible = "on";
ha4.background = 5;

subplot (2, 3, 5);
ha5 = gce ();
ha5.axes_visible = "on";
ha5.background = 6;

subplot (2, 3, 6);
ha6 = gce ();
ha6.axes_visible = "on";
ha6.background = 7;

Télécharger le fichier / Download the file Spas42212B.sce



4.21       LE HANDLE FIGURE  / THE HANDLE FIGURE
ALLER A L'INDEX GENERAL / GO TO THE GENERAL INDEX
ALLER A LA TABLE GENERALE / GO TO THE GENERAL TABLE
 4.23       LE HANDLE AXES  / THE HANDLE AXES