[Contents] [TitleIndex] [WordIndex

How To Turn the Canvas Off Silently


On some machines, creating graphics produces a warning message in Scilab's console. In this document, we explain how to customize the .scilab startup file in order to prevent this warning message from being displayed.

The problem

We sometimes use a system on which the graphics drivers cannot be used by Scilab. This happens for example on some Linux Ubuntu systems, especially on laptops. The typical situation is when we se a warning message when we create a 3D plot:

 WARNING: Due to your configuration limitations, Scilab switched in a mode 
       where mixing uicontrols and graphics is not available. Type "help u 
      secanvas" for more information.                                      

This warning does not cause problems by itself. But it is annoying, especially when we want to create unit test reference files (.ref), since the warning message is written in the reference file.

The solution

In order to avoid this, we can configure the .scilab startup file and turn off the canvas.

The problem is that turning the canvas off with the usecanvas function also displays the message:

 WARNING: Despite of our previous warning, you chose to use Scilab with ad 
      vanced graphics capabilities. Type "help usecanvas" for more informa 

In order to workaround this problem we may use the following trick.

First, let's open the .scilab startup file with the following statement:


Then paste the following source code:

// Turn usecanvas ON without displaying anything in the console
// Copyright (C) 2011 - DIGITEO - Clément David.
// Copyright (C) 2011 - DIGITEO - Michael Baudin
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution.  The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
function turnCanvasOff()
   m = getscilabmode();
   if (m=="STD"|m=="NW") then
       previousDisp = disp;
       prot = funcprot();
       deff("disp(str)", "");
       disp = previousDisp;
clear turnCanvasOff;

The trick used in this function is to locally redefine the disp function, so that the warning message is not displayed at all.

See also

Other graphics related issues are presented at Graphical issues with Scilab 5.X.

2022-09-08 09:27