// Demonstrates the usage of the plotxyf() function.
#include 
#include <chplot.h>
#include <math.h>

int main() {
    string_t title="Sine Wave",          //Define
           xlabel="Degrees",
           ylabel="Amplitude (Inches)";
    string_t file;
    file = tmpnam(NULL);                 //Create temporary file.
    int i;
    FILE *out;
    out=fopen (file,"w");              //Write data to file.
    for(i=0;i<=359;i++) fprintf(out,"%i %f \n",i,sin(i*M_PI/180));
    fclose(out);
    plotxyf(file,title,xlabel,ylabel); //Call plotting function.
    remove(file);
}