Programming and Graphics

(Kiana) #1

7.5 A graph with axes 225


}
}

//--- Complete the axes box:

move2 (xmax,ymin);
draw2 (xmax,ymax);
draw2 (xmin,ymax);

//--- Print plot titles:

color (lbc);
xmargin = 0.2*xrange;
ymargin = 0.2*yrange;

//--- First plot title:

font("/tmp/hfonts/futura.l");
float textszx = 0.4*xmargin; // text size
float textszy = 0.4*ymargin; // text size
textsize (textszx,textszy);
move2 (xmin+0.3*xrange,ymax+0.6*ymargin);
drawstr(title1);

//--- Second plot title:

font("/tmp/hfonts/times.ib");
textszx = 0.35*xmargin; // text size
textszy = 0.35*ymargin; // text size
textsize (textszx,textszy);
move2 (xmin+0.3*xrange,ymax+0.4*ymargin);
drawstr(title2);

//--- Third plot title:

font("/tmp/hfonts/times.i");
textszx = 0.30*xmargin; // text size
textszy = 0.30*ymargin; // text size
textsize (textszx,textszy);
move2 (xmin+0.3*xrange,ymax+0.2*ymargin);
drawstr(title3);

}

Code plot2d


The following program contained in the fileplot2d.ccdefines and plots
data points:

Free download pdf