Insets

Inset figures can easily be made from existing figures by moving the origin to the desired insertion point using translate(xpos,ypos );, changing the scale with scale(xfact,yfact);, and copying the existing code defining the inset figure into the current file using the editor block move functions. It is also useful to bracket the inset figure with a gsave(); / grestore(); pair in order to restore the original coordinates after the inset.

/* This figure demonstrates how to use axes other */
/* than the standard linear axes. Also it illustrates */
/* how insets can be made. Insets alternatively can */
/* be made by encapsulating an entire drawing in a */
/* subroutine. */

#include <splot.h>
			   
double *lifetime, *rawtime;          

main()           
   {             
   int i;
   double majortic,minortic;

   /* define a tic length  */
   /* major and minor tics */

   majortic=0.3;
   minortic=0.25;

   /* set up some default values */

   set(FONTASPECT,1.2);
   set(FONTWIDTH,0.8);
   set(PLOTTYPE,SYM_LINES);
   set(CURSYMBOL,CIRCLE);
   set(AXESCLIP,ON);
   set(LINEWIDTH,0.1);
   set(AXESTYPE,LOGY);

   /* get the data and set the box  */                
  
   readdata("demo\lifetime.dat",lifetime);
   /* draw axes box but not centered on the page */
   axes_box(13,17,-30,0.9,330,60,5.51,7.5);
  
   /* x-axis   */  
  
   /* major tics*/
  
   set(TICKLENGTH,majortic);
   tickmarks(XAXES,0,100,200,300);
  
   /* minor ticks */
  
   set(TICKLENGTH,minortic);
   set(LINEWIDTH,0.05);
   tickmarks(XAXES,25,50,75,125,150,175,225,250,275);
   ticklabel(BOTTOM,0,"0",100,"100",200,"200",300,"300");
  
   /* y-axis */
  
   /* major tics*/
  
   set(TICKLENGTH,majortic);
   set(LINEWIDTH,0.1);
   tickmarks(YAXES,1,10,50);
  
   /* minor ticks */
  
   set(TICKLENGTH,minortic);
   set(LINEWIDTH,0.05);
   tickmarks(YAXES,2,3,4,5,6,7,8,9,20,30,40);
   ticklabel(LEFT,1,10,50);
  
   /* axis labels */
  
   label(LOWER,"Temperature (K)");
   label(LEFT,"Lifetime (ms)");
  
   drawdata(lifetime,0,1);        

   /* now build the inset figure */
   /* insert  setup stuff */ 
   set(PLOTTYPE,LINES);
   set(LINEWIDTH,0.065);
   set(AXESTYPE,LOGY);
   readdata("demo\rawtime.dat",rawtime);
   axes_box(6,7.85,0.00,20,0.400,250000,8.02,10.19);
   set(LINEWIDTH,0.05);
   tickmarks(XAXES,0.1);
   tickmarks(YAXES,1);
   set(FONTASPECT,1.0);
   set(FONTWIDTH,0.67);
   ticklabel(BOTTOM,0,0.4);
   drawdata(rawtime,0,1);        
   text(11.30,16.64,"T=20K");
   label(LEFT,"Log Counts (Decades)");
   set(LABELMARG,-0.8);
   label(BOTTOM,"time (ms)");
   }