Inset plot (xfig example)
Jump to navigation
Jump to search
--- //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") ;