Search code examples
colorsbackgroundfiguresubplotscilab

Scilab Figure Background Color


I have recently started to use Scilab, and in general it works as a good replacement for MATLAB. One of the things that bothers me though is the figure background color. The first background color of a subplot is always grey, the next ones are white. I can change the white ones with figure options, or with the axle handles, but this does not seem to work for the first subplot of each figure. Is this a bug or am I doing something wrong?

(example code is nothing special:)

x=0:10
y=x

figure
subplot(3,1,1)
plot(x,y)
subplot(3,1,2)
plot(x,y)
subplot(3,1,3)
plot(x,y)

Example Picture


Solution

  • That seems to be an issue with figure. You'd better use scf(), which is "set current figure":

    scf();  //always creates new figure
    scf(n); //if window 'n' doesn't exist, it creates it
            //if it exists, it selects it
    

    I myself always use scf() together with clf(), which is "clear figure". Try the code below, it should work fine:

    x=0:10
    y=x
    
    scf(0); clf();
    subplot(3,1,1)
    plot(x,y)
    subplot(3,1,2)
    plot(x,y)
    subplot(3,1,3)
    plot(x,y)