Friday, May 15, 2009

Simple graphs - 5

Following our studies about the plot(.) function.

Now, let's learn how to change the line's style.

The possible line's styles in Scilab are:

  • Solid line (default);
  • Dashed line;
  • Dotted line;
  • Dash-dotted line;
  • No line.
Each style may be used with the argument color (cited on the last post).

Some examples:

-->x = 1:10;

-->y1 = x.^2 + 1;

-->plot(x, y1, "-");

-->y2 = x.^2 + 2;

-->plot(x + 10, y2, "--");

-->y3 = x.^2 + 3;

-->plot(x + 20, y3, ":");

-->y4 = x.^2 + 4;

-->plot(x + 30, y4, "-.");


The result:

You may use the line's styles with colors, for example:

--> plot(x, y, "r--");

No comments: