Difference between revisions of "Inset plot (xfig example)"

From Remeis-Wiki
Jump to navigation Jump to search
 
Line 2: Line 2:
  
 
====== Insets ======
 
====== Insets ======
As seen on the [[Compounds and multi-panel plots (xfig example)| multiplot]] page all plots in xfig are objects and can be combined. To plot a plot within another one, we need to add the object which defines the inset plot to the object which defines the overall plot. This can be done with the routine **''add_object''** of a given xfig-object. If ''a'' is an xfig object, and we want to plot ''b'' inside it, the command would be
+
As seen on the [[Compounds and multi-panel plots (xfig example)| multiplot]] page all plots in xfig are objects and can be combined. To plot a plot within another one, we need to add the object which defines the inset plot to the object which defines the overall plot. This can be done with the routine **''add_object''** of a given xfig-object. If <code>a</code> is an xfig object, and we want to plot <code>b</code> inside it, the command would be
 
   a.add_object(b, x, y) ;
 
   a.add_object(b, x, y) ;
where ''x'' and ''y'' are the coordinates where the center of ''b'' will appear within in ''a'' in coordinates of ''a''.  
+
Where <code>x</code> and <code>y</code> are the coordinates where the center of <code>b</code> will appear within in <code>a</code> in coordinates of <code>a</code>. If <code>x</code> and <code>y</code> are omitted, <code>b</code> is not translated, but added to <code>a</code> "as it is".
If ''x'' and ''y'' are omitted, ''b'' is not translated, but added to ''a'' "as it is".
 
  
More information can be obtained by reading ''xfig_plot_new.add.object(;help)'' and ''help xfig_plot--wcs''.
+
More information can be obtained by reading <code>xfig_plot_new.add.object(;help)</code> and <code>help xfig_plot--wcs</code>.
  
 
===== Short example =====
 
===== Short example =====

Latest revision as of 13:03, 18 April 2018

--- //an example added by Felix// ---

Insets

As seen on the multiplot page all plots in xfig are objects and can be combined. To plot a plot within another one, we need to add the object which defines the inset plot to the object which defines the overall plot. This can be done with the routine **add_object** of a given xfig-object. If a is an xfig object, and we want to plot b inside it, the command would be

 a.add_object(b, x, y) ;

Where x and y are the coordinates where the center of b will appear within in a in coordinates of a. If x and y are omitted, b is not translated, but added to a "as it is".

More information can be obtained by reading xfig_plot_new.add.object(;help) and help xfig_plot--wcs.

Short example
 variable x = [0:10:0.1] , y = cos(x) ;
 
 variable a = xfig_plot_new(6,6) ;
 variable b = xfig_plot_new(2,2) ;
 
 a.world(0,10,-1.5, 1.5) ;
 a.plot(x,y) ;
 
 b.world(0,10,-1,1);
 b.axis(;off) ;
 b.plot([0,10],[-1,-1] ; color="red") ;
 b.plot([0,0],[-1,1] ; color="blue2") ;
 b.plot(x,y) ;
 
 a.add_object(b, 5, 0, -0.5, -0.5) ;
 
 a.render("plots/testsin.eps") ;