Fill the area between two curves
filledbounds(x,bounds) filledbounds(...,"foreground",foregroundcolor) filledbounds(...,"background",backgroundcolor)
a n-by-1 matrix of doubles, the X-values
a n-by-2 matrix of doubles, the bounds. bounds(:,1) is the lower bound. bounds(:,2) is the upper bound.
a 1-by-1 matrix of strings, the color of the line around the area (default=color("gray50"))
a 1-by-1 matrix of strings, the color inside the filled area (default=color("gray75"))
When managing a data associated with an error, it is convenient to plot the lower and upper error bounds, and to fill the area in-between. When the data is depending on x, the error may also depend on x. filledbounds plots the lower and upper bounds, and paint the area between the two curves.
Implementation note
Unfortunately, Scilab does not support transparency at this time. Hence, only one such filled curve can be plotted at once. Moreover, it must be the first on the plot, so that latter plots can be visible.
// This is a function : x=linspace(0,10)'; y= x.*sin(x); // This is the noise (it depends on x): sigma=abs(x); low=y-1.96*sigma; upp=y+1.96*sigma; bounds=[low,upp]; filledbounds(x,bounds) plot(x,y,"b-") legend(["95% Conf. Inter","F"],"in_upper_left"); // Configure foreground scf(); filledbounds(x,bounds,"foreground",5) // red plot(x,y,"b-") legend(["95% Conf. Inter","F"],"in_upper_left"); // Configure background scf(); filledbounds(x,bounds,"background",3) // green plot(x,y,"b-") legend(["95% Conf. Inter","F"],"in_upper_left"); | ![]() | ![]() |