R Plot function
In the C program:
/* open file for R instructions */
sprintf(str,"%s/rfile.input", Dxmenu_Dir);
if ( (fpR = creat(str, MODE)) == -1) {
fprintf(stderr, "Cannot open file for R instructions.\n");
return;
}
/* load the file to be plotted */
sprintf(datafilename, "%s_%d_%d_profile", name, slice,where);
/* Put this in the file opened above and close the file*/
sprintf(str, "rplot(\"%s\")\n", datafilename);
write(fpR,str,sizeof(char)*strlen(str));
close(fpR);
/* run the R program */
sprintf(str, "/bin/csh %s/rfile.sh %s", Path1, Path2);
system(str);
}
Transcript
But now what we're going to do is we're going to create an R plot function. It's going to take a file name, and it's going to print the file name, it's going to create an X11 window to put the graphics in, and it's going so output into that X window the name of the file that we just passed, and it's going to compute the minimum and maximum of the data that are read to scale the plot, plot our data the Y label is going to be called the value, the X label is going to be a pixel, we set our limits for the range between the minimum and maximum we output our main title our subtitle, and now we go to sleep for five seconds. So it's going to output this data and then we're going to call it's a C system function- the system function sleep 5 - so the data will appear, then after five seconds it'll go away.