src/GamIO/FrameMaker.cc
/*************************************************************************
**									**
** 		              FrameMaker xy Plots			**
**									**
** Author	: TILO, SOSI, BEME 					**
** Description  : Takes a row_vector from input along with plot		**
**                parameters and produces a FrameMaker file containing	**
**		  an xy plot of the vector				**
**									**
*************************************************************************/


Author : TILO, SOSI, BEME
Description  : Takes a row_vector from input along with plot
parameters and produces a FrameMaker file containing
an xy plot of the vector
Author : TILO SOSI BEME Description : Takes a row_vector from input along with plot parameters and produces a FrameMaker file containing an xy plot of the vector
void FM_xyPlot(const std::string& filename, row_vector &vx, double xsize,
             double ysize, double xmin, double xmax, double ymin, double ymax)
  {
  int np = vx.elements();		
  if((xsize < 5) || (xsize > 20))
			    xsize = 14;	
  if((ysize < 5) || (ysize > 27))
			    ysize = 14;
  if ( ymin == 0 && ymax == 0 )
	FM_maxima(vx, ymin, ymax, 1);	
  if ( xmin == 0 && xmax == 0 )
  	FM_maxima(vx, xmin, xmax, 0);	
  double top, bottom, right, left;	
  FM_borders(xsize, ysize,
             top, bottom, right, left);
  double yscale = (top-bottom)/(ymax-ymin);
  double xscale = (right-left)/(xmax-xmin);
  std::ofstream out(filename.c_str());	
  FM_Begin(out);			
  FM_AFrames_Begin(out);		
  FM_AFrame_Set(out,xsize,ysize);	
  int j;				
  int npl = 128;			
  int anpl;				
  for (int i=0; i<np-1; i+=npl-1)	
    {					
    anpl = (npl<np-i)?npl:np-i;
    out << "  <PolyLine \n";
    out << "    <Fill 15> \n";	
    if (np>npl)
	out << "    <GroupID 1> \n";	
    out << Gform( "    <NumPoints %d>\n",anpl);
    for (j=i; j<i+anpl; j++)
      {
      out << Gform("    <Point %3.3f cm ", (vx.getRe(j)-xmin)*xscale+left);
      out << Gform("%3.3f cm>\n", (vx.getIm(j)-ymin)*yscale+bottom);
      }
    out << "    > # end of PolyLine \n";
    }
  if (np>npl)				
    FM_Group (out, 1);
  FM_Axis (out, 'x', bottom,
       left, right, xmin, xmax);	
  FM_Axis (out, 'y', left,
       bottom, top, ymin, ymax);	
  FM_AFrame_End (out);			
  FM_AFrames_End(out);			
  FM_ParaText_End (out);		
  FM_End(out);				
  }
void FM_xyPlot ( const std :: string & filename , row_vector & vx , double xsize , double ysize , double xmin , double xmax , double ymin , double ymax ) { int np = vx . elements ( ) ; if ( ( xsize < 5 ) || ( xsize > 20 ) ) xsize = 14 ; if ( ( ysize < 5 ) || ( ysize > 27 ) ) ysize = 14 ; if ( ymin == 0 && ymax == 0 ) FM_maxima ( vx , ymin , ymax , 1 ) ; if ( xmin == 0 && xmax == 0 ) FM_maxima ( vx , xmin , xmax , 0 ) ; double top , bottom , right , left ; FM_borders ( xsize , ysize , top , bottom , right , left ) ; double yscale = ( top - bottom ) / ( ymax - ymin ) ; double xscale = ( right - left ) / ( xmax - xmin ) ; std :: ofstream out ( filename . c_str ( ) ) ; FM_Begin ( out ) ; FM_AFrames_Begin ( out ) ; FM_AFrame_Set ( out , xsize , ysize ) ; int j ; int npl = 128 ; int anpl ; for ( int i = 0 ; i < np - 1 ; i += npl - 1 ) { anpl = ( npl < np - i ) ? npl : np - i ; out << " \n " ; out << " \n " ; if ( np > npl ) out << " \n " ; out << Gform ( " \n " , anpl ) ; for ( j = i ; j < i + anpl ; j ++ ) { out << Gform ( " " , ( vx . getRe ( j ) - xmin ) * xscale + left ) ; out << Gform ( " \n " , ( vx . getIm ( j ) - ymin ) * yscale + bottom ) ; } out << " \n " ; } if ( np > npl ) FM_Group ( out , 1 ) ; FM_Axis ( out , ' ' , bottom , left , right , xmin , xmax ) ; FM_Axis ( out , ' ' , left , bottom , top , ymin , ymax ) ; FM_AFrame_End ( out ) ; FM_AFrames_End ( out ) ; FM_ParaText_End ( out ) ; FM_End ( out ) ; }
FrameMaker xy Plots
FrameMaker xy Plots
// Input	filename  : Output filename // 		vx        : Data vector //		xsize     : Plot horizontal (x) dimension in cm //		ysize     : Plot vertical (y) dimension in cm //              xmin      : Minimum value for x-scale //              xmax      : Maximum value for x-scale //              ymin      : Minimum value for y-scale //              ymax      : Maximum value for y-scale // Return		  : Void. xy-plot is output to file // Total number of points // Insure plot sizes sensible // Begin scaling // Get vertical maxima if not specified // Get horizontal maxima if not specified // Declare and set margins // Scaling in x and y direction // Begin FrameMaker Plot // Open new file for plotting // FrameMaker begin comment // Anchored Frame begin // Header of Frame // Looping Index // Maximum points per PolyLine // Actual points per Polyline // Loop over all points plotting // in chunks of anpl points // Set Polyline transparent // Set an ID if multiple Polylines // Group all Polylines // Output x axis // Output y axis // End of Frame // Anchored Frame end // Create a TextFlow with Frame // FrameMaker end comment