示例#1
0
文件: testfit.c 项目: jfarrington/XRD
void FitGraceinit(){
/* set up to plot edge position vs edge width for all channels, different color
 for upper and lower thresholds and sca1 and sca2.
*/

int j;
char str1[256];

  if(GraceIsOpen()){
        GraceClose();
	}
  GraceOpen(32768);
  GracePrintf("page size 500,400");
  GracePrintf("redraw");
  GracePrintf("g0 on");
  GracePrintf("focus g0");
  GracePrintf("xaxis ticklabel char size 0.6");
  GracePrintf("yaxis ticklabel char size 0.6");
  for(j=0;j<4;j++){
       sprintf(str1,"s%i on",j);
       GracePrintf(str1);
       sprintf(str1,"s%i symbol %i",j,j+1);
       GracePrintf(str1);
       sprintf(str1,"s%i line type 0",j);
       GracePrintf(str1);
       }
#ifdef DEBUG
	printf("leaving FitGraceinit()\n");
#endif
}
示例#2
0
文件: testfit.c 项目: jfarrington/XRD
void ScanGraceinit(){
/* set up to plot data for all channels, different color
 for upper and lower thresholds and sca1 and sca2.
*/

int i,j;
char str1[256];
#ifdef DEBUG
	printf("entering ScanGraceinit()\n");
#endif

  if (GraceIsOpen()) GraceClose();
  GraceOpen(32768);
  GracePrintf("page size 450,350");
  GracePrintf("arrange(2,2,0.1,0.1,0.1)");
  GracePrintf("redraw");
  for(j=0;j<4;j++){
	sprintf(str1,"g%i on",j);
	GracePrintf(str1);
	sprintf(str1,"focus g%i",j);
	GracePrintf(str1);
	GracePrintf("xaxis ticklabel char size 0.6");
	GracePrintf("yaxis ticklabel char size 0.6");
	for(i=0;i<NPLT;i++){
		sprintf(str1,"g%i.s%i symbol %i",j,i,j+1);
		GracePrintf(str1);
		}
	}
#ifdef DEBUG
	printf("leaving ScanGraceinit()\n");
#endif

}
static int openXMGrace(cvodeData_t *data)
{
  double maxY;

  /* Open XMGrace */
  if ( !GraceIsOpen() ) {     
    GraceRegisterErrorFunction(grace_error); 
    /* Start Grace with a buffer size of 2048 and open the pipe */
    if ( GraceOpen(2048) == -1 ) {
      fprintf(stderr, "Can't run Grace. \n");
      return 1;
    }
    else if ( GraceIsOpen() ) {
      maxY = 1.0;
      /*
	"with g%d" might become useful, when printing multiple
	graphs into one XMGrace subprocess.
      */
      /* GracePrintf("with g%d", data->results->xmgrace); */
      GracePrintf("world xmax %g", data->currenttime);
      GracePrintf("world ymax %g", 1.25*maxY);
      GracePrintf("xaxis tick major %g", data->currenttime/10);
      /* GracePrintf("xaxis tick minor %d", (int) data->currenttime/100); */
      GracePrintf("yaxis tick major %g", (1.25*maxY)/12.5 );
      GracePrintf("xaxis label font 4");
      GracePrintf("xaxis label \"time\"");
      GracePrintf("xaxis ticklabel font 4");
      GracePrintf("xaxis ticklabel char size 0.7");
      GracePrintf("yaxis label font 4");
      GracePrintf("yaxis label \"concentration\"");    
      GracePrintf("yaxis ticklabel font 4");
      GracePrintf("yaxis ticklabel char size 0.7");
      if ( Model_isSetName(data->model->simple) )
	GracePrintf("subtitle \"%s\"", Model_getName(data->model->simple));
      else if  ( Model_isSetId(data->model->simple) )
	GracePrintf("subtitle \"%s\"", Model_getId(data->model->simple));
      else 
	GracePrintf("subtitle \"model has no name/id\"");
      GracePrintf("subtitle font 8");   
    }
  }
  else {
    fprintf(stderr, "Please close XMGrace first.\n");
    return 1;
  }

  return 0;
}