File: multiplot.sl

package info (click to toggle)
slxfig 0.2.0~.138-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,196 kB
  • sloc: sh: 3,086; ansic: 598; makefile: 265; php: 6
file content (24 lines) | stat: -rw-r--r-- 552 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
require ("xfig");

public define slsh_main ()
{
   variable n = 3;
   variable w = Struct_Type[n];
   variable x = [0:1:#1000];
   variable i;
   variable pow = [0.5, 1, 2];
   _for i (0, n-1, 1)
     {
	w[i] = xfig_plot_new (12, 3);
	w[i].plot (x, x^pow[i]);
	w[i].xlabel ("$x$");
	w[i].ylabel (sprintf ("$n = %g$", pow[i]));
	w[i].title (sprintf ("$y = x^{%g}$", pow[i]));
     }
   variable increasing = 1;
   xfig_multiplot (increasing 
		   ? (w[0], w[1], w[2])
		   : (w[2], w[1], w[0])
		   ; title="$y = x^n$"
		  ).render ("multiplot.png");
}