  maxx = mplot->origin.maxx - mplot->origin.minx;
  maxy = mplot->origin.maxy - mplot->origin.miny;
  x0 = mplot->origin.minx;
  y0 = mplot->origin.miny;
      dif1 = mplot->origin.phimax - mplot->origin.phimin;
      dif2 = mplot->origin.lammax-mplot->origin.lammin;
      lam = mplot->origin.lammin; 
      phi = mplot->origin.phimin  ;
	phi = mplot->origin.phimin + i * dif1 / inc;
      phi = mplot->origin.phimax;
	lam = mplot->origin.lammin - i * dif2 / inc;
      lam = mplot->origin.lammax; 
	phi = mplot->origin.phimax - i * dif1 / inc;
      phi = mplot->origin.phimin;
	lam = mplot->origin.lammax + i * dif2 / inc;
  for (klip = 0; klip < mplot->lip_num; klip++) 
    for (k = 0; k < mplot->lip[klip].n; k++) 
      geo2xy(mplot, mplot->lip[klip].lips[k].latlon.phi,
	     mplot->lip[klip].lips[k].latlon.lam, &x, &y);
      a = mplot->lip[klip].lips[k].ebar.x;
      b = mplot->lip[klip].lips[k].ebar.y;
      axis[0] = mplot->lip[klip].lips[k].lambda[0];
      axis[1] = mplot->lip[klip].lips[k].lambda[1];
      axis[2] = mplot->lip[klip].lips[k].lambda[2];
      dir[0] = (mplot->lip[klip].lips[k].vec[0][0] * dirin[0]
		+ mplot->lip[klip].lips[k].vec[0][1] * dirin[1]
		+ mplot->lip[klip].lips[k].vec[0][2] * dirin[2]);
      dir[1] = (mplot->lip[klip].lips[k].vec[1][0] * dirin[1]
		+ mplot->lip[klip].lips[k].vec[1][1] * dirin[1]
		+ mplot->lip[klip].lips[k].vec[1][2] * dirin[2]);
      dir[2] = (mplot->lip[klip].lips[k].vec[2][0] * dirin[2]
		+ mplot->lip[klip].lips[k].vec[2][1] * dirin[1]
		+ mplot->lip[klip].lips[k].vec[2][2] * dirin[2]);
  fprintf(inf, "%% 3D total files = %d\n", mplot->wire_num);
  for(kount = 0; kount < mplot->wire_num; kount++) 
    for(i = 0; i < mplot->wire[kount].n; i++) 
	      mplot->jmlcol[mplot->wire[kount].poly[i].col].red,
	      mplot->jmlcol[mplot->wire[kount].poly[i].col].green,
	      mplot->jmlcol[mplot->wire[kount].poly[i].col].blue);
      n = mplot->wire[kount].poly[i].n;
	      ps_kmx(mplot->wire[kount].poly[i].kmloc[0].x, x0),
	      ps_kmy(mplot->wire[kount].poly[i].kmloc[0].y, y0));
		ps_kmx(mplot->wire[kount].poly[i].kmloc[j].x, x0),
		ps_kmy(mplot->wire[kount].poly[i].kmloc[j].y, y0));
	   mplot->wire[kount].poly[i].kmloc[j].x,
	   mplot->wire[kount].poly[i].kmloc[j].y,
	   mplot->wire[kount].poly[i].kmloc[j].z); */
  int i, maxm = (int)(mplot->max_mag + 1), minm = (int)(mplot->min_mag);
  sizmag = get_mag_size((float)maxm, (float)mplot->SourceSize, mplot->min_mag,
			mplot->max_mag, mplot->mag_src_flag);
    fprintf(of, " %% maxsiz = %f maxm=%d mplot->max_mag=%f\n", sizmag, maxm,
	    mplot->max_mag);
      sizmag = get_mag_size((float)i, (float) mplot->SourceSize,
			    mplot->min_mag, mplot->max_mag,
			    mplot->mag_src_flag);
      sizmag = get_mag_size((float)i, (float)mplot->SourceSize, mplot->min_mag,
			    mplot->max_mag, mplot->mag_src_flag);
  int i, color_range = mplot->MaxColor - mplot->MinColor;
  fprintf(stderr, " Ps_Palette: MinColor=%d  MaxColor=%d\n", mplot->MinColor,
	  mplot->MaxColor);
    fprintf(of, "%f ", mplot->jmlcol[mplot->MinColor+i].red);
    fprintf(of, "%f ", mplot->jmlcol[mplot->MinColor+i].green);
    fprintf(of, "%f ", mplot->jmlcol[mplot->MinColor+i].blue);
  if(mplot->BW_flag == 1) 
  if(mplot->image_scale_flag == 0)
    fprintf(of, "0 1.1 bsiz moveto (%f) show\n", mplot->image.Temp_image_min);
	    mplot->image.Temp_image_max);
	    mplot->image.Layer_min[mplot->image_layer - 1]);
	    mplot->image.Layer_max[mplot->image_layer - 1]);
  if(mplot->image_scale_flag == 0)
    fprintf(of, " 1.1 bsiz 0 moveto (%f) show\n", mplot->image.Temp_image_min);
	    mplot->image.Temp_image_max);
	    mplot->image.Layer_min[mplot->image_layer - 1]);
	    mplot->image.Layer_max[mplot->image_layer - 1]);
  maxx = mplot->origin.maxx - mplot->origin.minx;
  maxy = mplot->origin.maxy - mplot->origin.miny;
  x0 = mplot->origin.minx;
  y0 = mplot->origin.miny;
  color_range = mplot->MaxColor - mplot->MinColor;
  if(mplot->image_layer > mplot->image.nz)
    mplot->image_layer = mplot->image.nz;
  if(mplot->image_layer < 1)
    mplot->image_layer = 1;
     mplot->image_layer); */
  npoints = mplot->image.nx * mplot->image.ny;
  phi = mplot->image.phi;
  lam = mplot->image.lam;
  hsizex = mplot->image.dx;
  hsizey = mplot->image.dy;
  start = (mplot->image_layer - 1) * npoints;
  PS_Border(of, mplot, mplot->project_type);
    if((mplot->image.col[i] != 0) && (mplot->image.col[i] != 1)) 
      i1 = mplot->image.col[i];
      /* fprintf(of, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
	 mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue); */
      citoxyz(mplot->image.nx, mplot->image.ny, mplot->image.nz, iway, &j,
      x = ps_kmx(xorg + (ix - 1) * mplot->image.dx, x0);
      y = ps_kmy(yorg + (iy - 1) * mplot->image.dy, y0);
	i1 = i1 - mplot->MinColor;
	  0.60 * maxx, maxy, mplot->image_layer,
	  mplot->image.z_parts[mplot->image_layer - 1],
	  mplot->image.z_parts[mplot->image_layer]);
  float x0 = mplot->origin.minx, y0 = mplot->origin.miny;
  for(j = 0; j < mplot->max_more_src - 1; j++) 
    for(i = 0; i < mplot->sources[j].numpoints; i++) 
      if(mplot->sources[j].loc[i].z <= mplot->MaxDepth)
		ps_kmx(mplot->sources[j].loc[i].x, x0),
		ps_kmy(mplot->sources[j].loc[i].y, y0),
		ps_kmx(mplot->sources[j + 1].loc[i].x, x0),
		ps_kmy(mplot->sources[j + 1].loc[i].y, y0));
  float px, py, x0 = mplot->origin.minx, y0 = mplot->origin.miny, phi, lam;
  for(kount = 0; kount < mplot->num_wells_files; kount++) 
    for(i = 0; i < mplot->wells[kount].well_count; i++) 
      phi = mplot->wells[kount].well[i].loc[0].x;
      lam = mplot->wells[kount].well[i].loc[0].y;
      i1 = mplot->wells[kount].well[i].color;
      fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
	      mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
      if(mplot->wells_name_flag)
		mplot->wells[kount].well[i].name);
      if(mplot->wells_symbol_flag)
		mplot->wells[kount].well[i].name);
  float px, py, x0 = mplot->origin.minx, y0 = mplot->origin.miny, phi, lam;
  if(mplot->hoz_slab_flag == 1)
	    mplot->hoz_slab_top, mplot->hoz_slab_bot);
  for(kount = 0; kount < mplot->num_wells_files; kount++)
    for(i = 0; i < mplot->wells[kount].well_count; i++) 
      if((mplot->hoz_slab_flag == 1)
	 && ((mplot->wells[kount].well[i].loc[0].z < mplot->hoz_slab_top)
	     || (mplot->wells[kount].well[i].loc[0].z > mplot->hoz_slab_bot)))
      i1 = mplot->wells[kount].well[i].color;
      fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
	      mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
      phi = mplot->wells[kount].well[i].loc[0].x;
      lam = mplot->wells[kount].well[i].loc[0].y;
      for(j = 1; j < mplot->wells[kount].well[i].nump; j++) 
	phi = mplot->wells[kount].well[i].loc[j].x;
	lam = mplot->wells[kount].well[i].loc[j].y;
  x0 = mplot->origin.minx;
  y0 = mplot->origin.miny;
  if(mplot->add_poly_lines == 1)
  if(mplot->map_type == 1) 
    for(i = 0; i < mplot->xy_map.numpoints; i++) 
      if(((mplot->xy_map.km[i].x1 > mplot->origin.minx)
	  && (mplot->xy_map.km[i].x1 < mplot->origin.maxx)
	  && (mplot->xy_map.km[i].y1 > mplot->origin.miny)
	  && (mplot->xy_map.km[i].y1 < mplot->origin.maxy))
	 || ((mplot->xy_map.km[i].x2 > mplot->origin.minx)
	     && (mplot->xy_map.km[i].x2 < mplot->origin.maxx)
	     && (mplot->xy_map.km[i].y2 > mplot->origin.maxx)
	     && (mplot->xy_map.km[i].y2 < mplot->origin.maxy)))
		ps_kmx(mplot->xy_map.km[i].x1, x0),
		ps_kmy(mplot->xy_map.km[i].y1,y0),
		ps_kmx(mplot->xy_map.km[i].x2, x0),
		ps_kmy(mplot->xy_map.km[i].y2,y0));
  if(mplot->map_type > 1) 
    for(kount = 0; kount < mplot->num_map_files; kount++)
      fprintf(inf, " \n\n %%  MAPFILE = %s\n\n", mplot->map[kount].file_name);
      for(k = 0; k < mplot->map[kount].stroke_count; k++)
	for(i = kk; i < kk + mplot->map[kount].stroke[k].num; i++)
	  if((mplot->map[kount].km[i].x > mplot->origin.minx)
	     && (mplot->map[kount].km[i].x < mplot->origin.maxx)
	     && (mplot->map[kount].km[i].y > mplot->origin.miny)
	     && (mplot->map[kount].km[i].y < mplot->origin.maxy))
	c = mplot->map[kount].map_code;
	while(*(c++) != mplot->map[kount].stroke[k].code) 
	  if(mplot->map[kount].stroke[k].style > 1) 
		    ps_kmx(mplot->map[kount].km[kk].x,x0),
		    ps_kmy(mplot->map[kount].km[kk].y,y0));
	    for(i = kk + 1; i < kk + mplot->map[kount].stroke[k].num; i++)
		      ps_kmx(mplot->map[kount].km[i].x,x0),
		      ps_kmy(mplot->map[kount].km[i].y,y0));
	    i1 = mplot->map[kount].stroke[k].col;
		    mplot->map[kount].stroke[k].name);
	    fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
		    mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
	    switch(mplot->map[kount].stroke[k].style) 
		if(mplot->map_type>2) fprintf(inf, " stroke \n");
		  if(mplot->BW_flag == 1)
		    for(ii = 0;ii < mplot->Formation_count; ii++)
			 mplot->Formation_color[ ii ]); */
		      if(mplot->Formation_color[ii] == i1) break;
	  if(mplot->map[kount].stroke[k].style == 1) 
		    ps_kmx(mplot->map[kount].km[kk].x, x0),
		    ps_kmy(mplot->map[kount].km[kk].y, y0));
	    i1 = mplot->map[kount].stroke[k].col;
	    if(lastcol != mplot->map[kount].stroke[k].col)
		      mplot->jmlcol[i1].red, mplot->jmlcol[i1].green,
		      mplot->jmlcol[i1].blue,
		      mplot->map[kount].stroke[k].name);
			 mplot->map[kount].stroke[k].name);
	    lastcol = mplot->map[kount].stroke[k].col;
	kk += mplot->map[kount].stroke[k].num;
  float sizsta, x0 = mplot->origin.minx, y0 = mplot->origin.miny;
  fprintf(inf, "\n%%stations flag=%d number files=%d\n\n", mplot->sta_flag,
	  mplot->num_sta_files);
  for(kount = 0; kount < mplot->num_sta_files; kount++) 
	    mplot->stations[kount].file_name);
	    mplot->jmlcol[mplot->stations[kount].color].red,
	    mplot->jmlcol[mplot->stations[kount].color].green,
	    mplot->jmlcol[mplot->stations[kount].color].blue);
	    mplot->jmlcol[mplot->stations[kount].color].red,
	    mplot->jmlcol[mplot->stations[kount].color].green,
	    mplot->jmlcol[mplot->stations[kount].color].blue);
    switch(mplot->stations[kount].symbol)
    sizsta = 1.5 * mplot->size_sta;
    for(i = 0; i < mplot->stations[kount].numpoints; i++) 
	if((mplot->stations[kount].sta[i].loc.x > mplot->origin.minx)
	   && (mplot->stations[kount].sta[i].loc.x < mplot->origin.maxx)
	   && (mplot->stations[kount].sta[i].loc.y > mplot->origin.miny)
	   && (mplot->stations[kount].sta[i].loc.y < mplot->origin.maxy))
		    ps_kmx(mplot->stations[kount].sta[i].loc.x, x0), 
		    ps_kmy(mplot->stations[kount].sta[i].loc.y, y0), 
		    mplot->stations[kount].sta[i].name);
	    if(mplot->sta_name_flag) 
			ps_kmx(mplot->stations[kount].sta[i].loc.x, x0), 
			ps_kmy(mplot->stations[kount].sta[i].loc.y, y0),
			mplot->stations[kount].sta[i].name);
  float sizmag, x0 = mplot->origin.minx, y0 = mplot->origin.miny;
  if(mplot->BW_flag == 1) 
    sizmag = 0.4 * (mplot->SourceSize / 3);
    sizmag = 0.4 * (mplot->SourceSize / 3);
  if(mplot->fancy_src_flag == 1)
  if(mplot->BW_flag == 1)
	  mplot->sources[j].file_name);
  i1 = mplot->src_color - j;
  fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
	  mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
  for(i = 0; i < mplot->sources[j].numpoints; i++) 
    if(mplot->sources[j].onoff[i] == 1) 
      if(mplot->src_depth_color) 
	i1 = mplot->sources[j].point_color[i];
	fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
		mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
      sizmag =mplot->sources[j].size[i];
      if(mplot->mag_src_flag == 0) sizmag = 1;
      if((mplot->sources[j].loc[i].x > mplot->origin.minx)
	 && (mplot->sources[j].loc[i].x < mplot->origin.maxx)
	 && (mplot->sources[j].loc[i].y > mplot->origin.miny)
	 && (mplot->sources[j].loc[i].y < mplot->origin.maxy))
		ps_kmx(mplot->sources[j].loc[i].x, x0),
		ps_kmy(mplot->sources[j].loc[i].y, y0), sizmag);
  if(mplot->more_src_flag) 
    for(j = 1; j < mplot->max_more_src; j++) 
      if(mplot->BW_flag == 1) 
	      mplot->sources[j].file_name);
      i1 = mplot->src_color - j;
      fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
	      mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
      for(i = 0; i < mplot->sources[j].numpoints; i++) 
	if(mplot->sources[j].onoff[i] == 1) 
	  if(mplot->src_depth_color) 
	    i1 = mplot->sources[j].point_color[i];
	    fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
		    mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
	  sizmag = mplot->sources[j].size[i];
	  if(mplot->mag_src_flag == 0) sizmag = 1;
	  if((mplot->sources[j].loc[i].x > mplot->origin.minx)
	     && (mplot->sources[j].loc[i].x < mplot->origin.maxx)
	     && (mplot->sources[j].loc[i].y > mplot->origin.miny)
	     && (mplot->sources[j].loc[i].y < mplot->origin.maxy))
		    ps_kmx(mplot->sources[j].loc[i].x, x0),
		    ps_kmy(mplot->sources[j].loc[i].y, y0), sizmag);
  maxy = mplot->origin.maxy - mplot->origin.miny;
  if(mplot->BW_flag == 1) 
    for(j = 0; j < mplot->max_more_src; j++) 
      i1 = mplot->src_color - j;
      fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
	      mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
	      " (%s) show \n",  j + 1, mplot->sources[j].file_name);
    for(j = 0; j < mplot->max_more_src; j++) 
      i1 = mplot->src_color - j;
      fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
	      mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
	      " (%s) show \n",  j + 1, mplot->sources[j].file_name);
    x0 = mplot->origin.minx, y0 = mplot->origin.miny;
  focrad = mplot->size_focm / 2;
  for(kount = 0; kount < mplot->num_focm_files; kount++)
    for(i = 0; i < mplot->focm[kount].numpoints; i++) 
      phi = mplot->focm[kount].focs[i].loc.x;
      lam = mplot->focm[kount].focs[i].loc.y;
      if((px < mplot->origin.minx) || (px > mplot->origin.maxx)
	  || (py < mplot->origin.miny) || (py > mplot->origin.maxy)) 
      focrad = mplot->size_focm / 2;
      if(mplot->focm[kount].scale_by_mag == 1) 
	if(mplot->focm[kount].minMag < mplot->focm[kount].maxMag)
	  focrad += (focrad * (mplot->focm[kount].focs[i].ac.mag
			       - mplot->focm[kount].minMag)
		     / (mplot->focm[kount].maxMag
			- mplot->focm[kount].minMag));
	else focrad = mplot->size_focm / 2;
	      mplot->jmlcol[mplot->focm[kount].focs[i].type].red,
	      mplot->jmlcol[mplot->focm[kount].focs[i].type].green,
	      mplot->jmlcol[mplot->focm[kount].focs[i].type].blue);
      if(mplot->focal_explode >= 1) 
		ps_kmx(mplot->focm[kount].focs[i].explode_x, x0),
		ps_kmy(mplot->focm[kount].focs[i].explode_y, y0));
		ps_kmx(mplot->focm[kount].focs[i].explode_x, x0),
		ps_kmy(mplot->focm[kount].focs[i].explode_y, y0));
      switch(mplot->focal_plot_style) 
		mplot->jmlcol[mplot->focm[kount].focs[i].type].red,
		mplot->jmlcol[mplot->focm[kount].focs[i].type].green,
		mplot->jmlcol[mplot->focm[kount].focs[i].type].blue);
		mplot->focm[kount].focs[i].fm.strk1,
		mplot->focm[kount].focs[i].fm.dip1);
	Slip_Point(mplot->focm[kount].focs[i].fm.strk1,
		   mplot->focm[kount].focs[i].fm.dip1,
		   mplot->focm[kount].focs[i].fm.strk2,
		   mplot->focm[kount].focs[i].fm.dip2,
		   mplot->focm[kount].focs[i].fm.trot,
		   mplot->focm[kount].focs[i].fm.tdip,
		mplot->focm[kount].focs[i].fm.strk2,
		mplot->focm[kount].focs[i].fm.dip2);
	fprintf(inf, " %f %f plPTax \n", mplot->focm[kount].focs[i].fm.prot,
		mplot->focm[kount].focs[i].fm.pdip);
	fprintf(inf, " %f %f plPTax \n", mplot->focm[kount].focs[i].fm.trot,
		mplot->focm[kount].focs[i].fm.tdip);
		mplot->jmlcol[mplot->focm[kount].focs[i].type].red,
		mplot->jmlcol[mplot->focm[kount].focs[i].type].green,
		mplot->jmlcol[mplot->focm[kount].focs[i].type].blue);
	fprintf(inf, " %f %f plPTax \n", mplot->focm[kount].focs[i].fm.prot,
		mplot->focm[kount].focs[i].fm.pdip);
		mplot->jmlcol[mplot->focm[kount].focs[i].type].red,
		mplot->jmlcol[mplot->focm[kount].focs[i].type].green,
		mplot->jmlcol[mplot->focm[kount].focs[i].type].blue);
	fprintf(inf, " %f %f plPTax \n", mplot->focm[kount].focs[i].fm.trot,
		mplot->focm[kount].focs[i].fm.tdip);
		mplot->jmlcol[mplot->focm[kount].focs[i].type].red,
		mplot->jmlcol[mplot->focm[kount].focs[i].type].green,
		mplot->jmlcol[mplot->focm[kount].focs[i].type].blue);
		mplot->focm[kount].focs[i].fm.strk1,
		mplot->focm[kount].focs[i].fm.dip1);
		mplot->focm[kount].focs[i].fm.strk1,
		mplot->focm[kount].focs[i].fm.dip1,
		mplot->focm[kount].focs[i].fm.strk2,
		mplot->focm[kount].focs[i].fm.dip2,
		mplot->focm[kount].focs[i].ipol);
	if(mplot->focal_plot_style == 2) 
	  fprintf(inf, " %f %f plPax \n", mplot->focm[kount].focs[i].fm.prot,
		  mplot->focm[kount].focs[i].fm.pdip);
	  fprintf(inf, " %f %f plTax \n", mplot->focm[kount].focs[i].fm.trot,
		  mplot->focm[kount].focs[i].fm.tdip);
	if(mplot->focal_plot_style == 4) 
		  mplot->focm[kount].focs[i].fm.strk1,
		  mplot->focm[kount].focs[i].fm.dip1);
  float maxx, maxy /*, x0 = mplot->origin.minx, y0 = mplot->origin.miny*/ ;
  maxx = mplot->origin.maxx - mplot->origin.minx;
  maxy = mplot->origin.maxy - mplot->origin.miny;
  for(i = 0; i < mplot->Formation_count; i++)
    i1 = mplot->Formation_color[i];
    if(mplot->BW_flag == 1)
	      " setgray stroke \n", -(i + 1) * 1.3, mplot->jmlcol[i1].red,
	      mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
	    " \n", -(i + 1) * 1.3, mplot->Formation_name[i]);
  float size = 3, px, py, pz, x0 = mplot->origin.minx, y0 = mplot->origin.miny;
  fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[1].red,
	  mplot->jmlcol[1].green, mplot->jmlcol[1].blue);
  for(j = 0; j < mplot->contParms.length_data; j++) 
    px = mplot->contParms.datapt[j].x;
    py = mplot->contParms.datapt[j].y;
    pz = mplot->contParms.datapt[j].z;
  float size = 3, px, py, pz, x0 = mplot->origin.minx, y0 = mplot->origin.miny;
  fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[1].red,
	  mplot->jmlcol[1].green, mplot->jmlcol[1].blue);
  for(j = 0; j < mplot->contParms.length_data; j++) 
    px = mplot->contParms.datapt[j].x;
    py = mplot->contParms.datapt[j].y;
    pz = mplot->contParms.datapt[j].z;
  float px, py, p1, p2, maxx, maxy, x0 = mplot->origin.minx,
    y0 = mplot->origin.miny;
  maxx = mplot->origin.maxx - mplot->origin.minx;
  maxy = mplot->origin.maxy - mplot->origin.miny;
  Col_Diff = (mplot->contParms.MaxCol - mplot->contParms.MinCol);
  valdiff = (mplot->contParms.minmax.zmax - mplot->contParms.minmax.zmin);
  PS_Border(inf, mplot, mplot->project_type);
  C_r = mplot->contParms.cont_struct;
      /* i1 = ((mplot->MaxColor - mplot->MinColor) *
	 (C_r->cont_level[k] - mplot->contParms.minmax.zmin) /
	 (mplot->contParms.minmax.zmax - mplot->contParms.minmax.zmin)) +
	 mplot->MinColor;*/
      i1 = (Col_Diff * (C_r->cont_level[k] - mplot->contParms.minmax.zmin)
	    / valdiff) + mplot->contParms.MinCol;
      fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
	      mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
  maxy = mplot->origin.maxy - mplot->origin.miny;
    i1 = mplot->MinColor+ j;
    fprintf(inf, "%f %f %f setcol1 \n", mplot->jmlcol[i1].red,
	    mplot->jmlcol[i1].green, mplot->jmlcol[i1].blue);
	  " show\n", plx1, ply1, mplot->MaxDepth);
  float x0 = mplot->origin.minx, y0 = mplot->origin.miny;
  for(i = 0; i <= mplot->num_labels; ++i) 
	    ps_kmx(mplot->labels[i].kmloc.x1,x0),
	    ps_kmy(mplot->labels[i].kmloc.y1,y0),
	    ps_kmx(mplot->labels[i].kmloc.x2,x0),
	    ps_kmy(mplot->labels[i].kmloc.y2,y0));
	    mplot->labels[i].label, ps_kmx(mplot->labels[i].kmloc.x1,x0),
	    ps_kmy(mplot->labels[i].kmloc.y1,y0));
  maxx = mplot->origin.maxx - mplot->origin.minx;
  maxy = mplot->origin.maxy - mplot->origin.miny;
  x0 = mplot->origin.minx;
  y0 = mplot->origin.miny;
  for(i = 0; i < mplot->markup.numpoints; i++) 
    if(mplot->markup.stuff[i].code1 == 1) 
      if(mplot->markup.stuff[i].min != 0)
		abs(mplot->markup.stuff[i].deg), mplot->markup.stuff[i].min, 
		ps_kmx(mplot->markup.stuff[i].m.x, x0),
		ps_kmy(mplot->markup.stuff[i].m.y, y0));
		abs(mplot->markup.stuff[i].deg),
		ps_kmx(mplot->markup.stuff[i].m.x, x0),
		ps_kmy(mplot->markup.stuff[i].m.y, y0));
    if(mplot->markup.stuff[i].code1 == 3)
	      (double)fabs(mplot->markup.stuff[i].ddeg),
	      ps_kmx(mplot->markup.stuff[i].m.x, x0),
	      ps_kmy(mplot->markup.stuff[i].m.y, y0));
  for(i = 0; i < mplot->markup.numpoints; i++) 
    if(mplot->markup.stuff[i].code1 == 2) 
      if(mplot->markup.stuff[i].min != 0)
		abs(mplot->markup.stuff[i].deg), mplot->markup.stuff[i].min,
		ps_kmx(mplot->markup.stuff[i].m.x, x0),
		ps_kmy(mplot->markup.stuff[i].m.y, y0));
		abs(mplot->markup.stuff[i].deg),
		ps_kmx(mplot->markup.stuff[i].m.x, x0),
		ps_kmy(mplot->markup.stuff[i].m.y, y0));
    if(mplot->markup.stuff[i].code1 == 4) 
	      (double)fabs(mplot->markup.stuff[i].ddeg),
	      ps_kmx(mplot->markup.stuff[i].m.x, x0),
	      ps_kmy(mplot->markup.stuff[i].m.y, y0));
  /* colors =  mplot->colors;
     printf(" Number of colors = %d\n", mplot->num_colors);
  maxx = mplot->origin.maxx - mplot->origin.minx;
  maxy = mplot->origin.maxy - mplot->origin.miny;
  x0 = mplot->origin.minx;
  y0 = mplot->origin.miny;
  /* for ( i = 0; i< mplot->num_colors; i++)
     mplot->jmlcol[i].red, mplot->jmlcol[i].green, mplot->jmlcol[i].blue);
  xkmmax = mplot->origin.maxx - mplot->origin.minx;
  ykmmax = mplot->origin.maxy - mplot->origin.miny;
  if(mplot->BW_flag == 1)
  fprintf(inf, "%% Origin File: %s\n", mplot->origin_file);
  fprintf(inf, "%% Origin: %f %f %f %f\n", mplot->origin.phimin,
	  mplot->origin.phimax, mplot->origin.lammin, mplot->origin.lammax);
  fprintf(inf, "%% Input KM Box: %f %f %f %f\n", mplot->origin.minx,
	  mplot->origin.miny, mplot->origin.maxx, mplot->origin.maxy);
  PS_Border(inf, mplot, mplot->project_type);
  PS_Border(inf, mplot, mplot->project_type);
	  maxx / 2.0, maxy, mplot->Overall_title);
  if(fx == 0.0) fx = mplot->gr.user_xdif / 4;
  if(mplot->focm_flag >= 1) 
      fprintf(inf, " %f %f %f setcol1 \n", mplot->jmlcol[itype[i]].red,
	      mplot->jmlcol[itype[i]].green, mplot->jmlcol[itype[i]].blue);
  if(mplot->image_flag > 0)
  PS_Border(inf, mplot, mplot->project_type);
  if(mplot->map_flag) plot_ps_map(inf, mplot);
  /* fprintf(stderr, "outpostM: stations %d %d\n", mplot->sta_flag,
     mplot->num_sta_files); */
  if(mplot->sta_flag == 1) plot_ps_stations(inf, mplot);
  if(mplot->src_flag == 1) num_events = plot_ps_sources(inf, mplot);
  if(mplot->connect_flag) plot_ps_connect_sources(inf, mplot);
  if(mplot->wells_flag > 1) 
    if((mplot->wells_symbol_flag == 1) || (mplot->wells_name_flag == 1))
    if(mplot->wells_project_flag == 1) plot_ps_proj_wells( inf,  mplot);
  if(mplot->xsec_flag) 
    for(i = 0; i <= mplot->num_xsec; i++) 
  if(mplot->point_flag > 0) Plot_Points_Map(inf, mplot);
  if(mplot->plot_cont_flag == 1) plot_ps_contours(inf, mplot);	
  if(mplot->plot_cont_points == 1) plot_ps_Cont_points(inf, mplot);
  if(mplot->plot_cont_values == 1) plot_ps_Cont_values(inf, mplot);
  if(mplot->focm_flag > 1) plot_ps_map_focals(inf, mplot);
  if(mplot->wire_flag) 
  if(mplot->lip_flag) 
  if((mplot->src_flag == 1) && mplot->more_src_flag
     && (mplot->src_depth_color != 1))
  PS_Border(inf, mplot, mplot->project_type);
  if(mplot->num_labels >= 0) plot_ps_labels(inf, mplot);
  if(mplot->src_depth_color) plot_ps_color_depth(inf, mplot);
  PS_Border(inf, mplot, mplot->project_type);
  /* if(mplot->mag_src_flag == 1 && (mplot->more_src_flag
     || mplot->src_flag)) */
  if((mplot->mag_src_flag > 0) && (num_events > 2))
   /*  fprintf(stderr, "magscale stuff: flag=%d num=%d\n", mplot->mag_src_flag, num_events); */
    if(( mplot->max_mag  - mplot->min_mag)<2)fprintf(inf, "%% commented out %%");
    if(mplot->focm_flag >= 1)
  if(mplot->geotab_flag) plot_ps_geotab(inf, mplot);
