[Scilab-users] color under a curve
Dang, Christophe
Christophe.Dang at sidel.com
Wed Mar 13 14:29:58 CET 2013
Hello,
If the curve is on one side of the x-axis
(i.e. always positive or negative),
then you can use something simpler,
but far less general.
// **********
// set of data for the example
x = linspace(-%pi/2,%pi/2,50);
y = cos(x);
// completion to have a closed area
xmin = min(x); xmax = max(x);
ymin = min(y); ymax = max(y);
x($+1) = x($); x($+1) = xmin;
y($+1) = 0; y($+1) = 0;
// filled area only
xfpoly(x,y);
h = gce();
h.line_mode = "off";
h.background = 4; // adjust to your colour
// curve alone (auto adjust of the axes)
plot(x(1:$-2), y(1:$-2));
// **********
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
More information about the users
mailing list