7.5 A graph with axes 223
,char labely[] // y-axis label
,char title1[] // first plot title
,char title2[] // second plot title
,char title3[] // third plot title
)
{
//--- Prepare:
float xrange = xmax-xmin;
float yrange = ymax-ymin;
float xmargin = 0.1*xrange;
float ymargin = 0.1*yrange;
float rticx = xrange/ntcx; // x tick distance
float rticy = yrange/ntcy; // y tick distance
float tchx = 0.1*xmargin; // x tick height
float tchy = 0.1*ymargin ; // y tick height
//--- Draw x and y axes:
color (axc);
move2 (xmin,ymin);
draw2 (xmax,ymin);
move2 (xmin,ymin);
draw2 (xmin,ymax);
//--- Print axes labels at the end of the axes:
move2 (xmax+0.5*rticx, ymin-0.1*ymargin);
drawstr (labelx);
move2 (xmin-0.8*xmargin, ymax+0.3*ymargin);
drawstr (labely);
/*----------------------------
Prepare to draw axes ticks
Generate tick labels
Print them in file "xyunit"
Read them as characters into arrays: xunit, yunit
---------------------------------*/
if(Ilabelax==1)
{
ofstream file1;
file1.open("xyunit");