Plot

Shang is not equipped with built-in functionalities for plotting. A set of programs written in Shang language can create graphics in postscript format. To use it, the program "plot.x" needs to be run first. Here is a simple example

    with("plot.x");
    x = linspace(-pi, pi);
    y = exp(-0.3 * x.^2) .* cos(5 * x);
    z = exp(-0.3 * x.^2) .* sin(5 * x);
    fig = figure.new();
    fig.plot(x, y);
    fig.plot(x, z);
    fig.save("example.eps");
You need a postscript viewer to view, print, or conver the .eps files.



oz 2009-12-22