Now, how change the graph's color?
The plot(.) has a argument that's a string.
We can do:
- plot(x, y, color);
- plot(y, color);
The possible colors are:
- red ("r");
- green ("g");
- blue ("b");
- cyan ("c");
- magenta ("m");
- yellow ("y");
- black ("k");
- white ("w").
Let's do an example:
-->x = [-100:100]';
-->y1 = abs(x.^3)/1e+5;
-->y2 = x.^3 + x.^2 + 1;
-->y3 = tanh(0.01*x);
-->y2 = y2/max(y2);
-->plot(x, y1);
-->plot(x, y2, "r");
-->plot(x, y3, "g");
-->scf(); plot(x, y2, "k"); plot(x, y3, "y");
This example uses some functions that I had written about, so review the blog if you don't understand anything, or comment here.
The result is following.
Look that the default color is blue.
No comments:
Post a Comment