'Scilab: gca().grid=[1,1] applies a grid to wrong subplot axes
I'm a bit of a newbie at Scilab / Matlab so I might not know some of the finer details and strategies.
I'm running Scilab 6.1.1 on Windows 10.
I want to plot 2 datasets in the same figure using subplot but it seems scilab is doing some weird stuff.
Here's my script:
Ts = 1/20000;
t = 0:Ts:100-Ts;
P = mtlb_a(100000+34000*sin(0.2*2*%pi*t),6750*squarewave(0.5*2*%pi*t));
figure(1)
subplot(211) //top subplot
gca().filled="off" //make background transparent
plot((0:max(size(P))-1) * Ts,P/1000,"-b","LineWidth",2) //plot data
gca().grid=[1,1] //gridlines black
gca().x_label.text="x label for subplot 211"
subplot(212) //bottom subplot
gca().filled="off"
plot((0:max(size(P))-1) * Ts,P/1000,"-b","LineWidth",2)
gca().data_bounds = [0,65,50,150]; //change axis bounds
gca().grid=[3,3] //gridlines green
gca().x_label.text="x label for subplot 212"
This is the result on my machine
Notice how the gridlines are being applied to the wrong subplots, they are the wrong colors and the wrong spacing. But the other axes properties like the x_label and data_bounds are working fine.
I don't think I'm missing anything, is it a bug? Any ideas how to fix it? or is there a workaround I can do or something? This mostly wouldn't be a problem if the gridline spacings weren't wrong.
Solution 1:[1]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | S. Gougeon |


