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

From Remeis-Wiki
Jump to navigation Jump to search
(Created page with "--- //an example added by Felix// --- ====== Insets ====== As seen on the isis:slxfig:multiplot page all plots in xfig are objects and can be combined. To plot a plot wit...")
 
Line 2: Line 2:
  
 
====== Insets ======
 
====== Insets ======
As seen on the [[isis:slxfig: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 ''a'' is an xfig object, and we want to plot ''b'' 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 ''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".
 
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 ''xfig_plot_new.add.object(;help)'' and ''help xfig_plot--wcs''.
  
 
===== Short example =====
 
===== Short example =====

Revision as of 13:01, 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") ;