5.2 The Media

There are different graphics devices in Scilab which can be used to send graphics to windows or paper. The default for the output is ScilabGraphic0 window .

The different drivers are:

In the 3 first cases the 'implicit' device is a graphics window (existing or created by the plot). For the 2 last cases we will see later how to affect a specific device to the plot : a file where the plot will be recorded in the Postscript or Xfig format.

The basic Scilab graphics commands are :

In fact, the regular driver for a common use is Rec and there are special commands in order to avoid a change of driver; in many cases, one can ignore the existence of drivers and use the functions xbasimp, xs2fig in order to send a graphic to a printer or in a file for the Xfig system. For example with :

-->driver('Pos')
 
-->xinit('foo.ps')
 
-->plot(1:10)
 
-->xend()
 
-->driver('Rec')
 
-->plot(1:10)
 
-->xbasimp(0,'foo1.ps')

we get two identical Postscript files : 'foo.ps' and 'foo1.ps.0' (the appending 0 is the number of the active window where the plot has been done).

The default for plotting is the superposition; this means that between 2 different plots one of the 2 following command is needed: xbasc(window-number) which clears the window and erase the recorded Scilab graphics command associated with the window window-number or xclear) which simply clears the window.

If you enlarge a graphic window, the command xbasr(window-number) is executed by Scilab. This command clears the graphic window window-number and replays the graphic commands associated with it. One can call this function manually, in order to verify the associated recorded graphics commands.

Any number of graphics windows can be created with buttons or with the commands xset or xselect. The environment variable DISPLAY can be used to specify an X11 Display or one can use the xinit function in order to open a graphic window on a specific display.