source: project/octave/octave.scm @ 6111

Last change on this file since 6111 was 6111, checked in by paf, 12 years ago

Version 0.4

File size: 21.1 KB
Line 
1;;; @Package     octave.scm
2;;; @Subtitle    A simple interface to GNU/Octave
3;;; @HomePage    http://carretechnologies.com/octave-egg/
4;;; @Author      Pierre-Alexandre Fournier
5;;; @AuthorEmail octave-egg@@carretechnologies.com
6;;; @Version     0.4
7;;; @Date        September 17th 2007
8
9;; $Id:  $
10
11
12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
13;;; Octave interface version
14(define (octave:version) "0.4")
15
16
17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18;;; Octave ports and pid
19(define octave:input-port  #f)
20(define octave:output-port #f)
21(define octave:pid         #f)
22
23
24;;; Compatibility layer for Chicken and Gambit
25(cond-expand
26 ;;;;;;;;;;;;;;;;;;;;;; Chicken ;;;;;;;;;;;;;;;;;;;;;;;
27 (chicken
28  (declare (export 
29            ;; base variables and functions
30            octave:version
31            octave:input-port
32            octave:output-port
33            octave:pid
34            octave:start
35            octave:stop
36            octave:send
37            ;; 2d plot functions
38            octave:plot
39            octave:semilogx
40            octave:semilogy
41            octave:loglog
42            octave:polar
43            octave:bar
44            octave:mesh-xyz
45            ;; 3d plot functions
46            octave:mesh
47            octave:contour
48            octave:imagesc
49            ;; Labels
50            octave:title
51            octave:xlabel
52            octave:ylabel
53            octave:legend
54            octave:grid
55            ;; Other
56            octave:figure
57            octave:replot
58            ;; Files
59            octave:supported-file-types
60            octave:save-plot-to
61            ))
62
63  (use posix)
64  ;;; Start octave process
65  (define (octave:start)
66    (let-values ((octave:process-info (process "octave -q")))
67                (set! octave:input-port  (car   octave:process-info))
68                (set! octave:output-port (cadr  octave:process-info))
69                (set! octave:pid         (caddr octave:process-info))))
70
71
72  ;;; Stop octave process
73  (define (octave:stop)
74    (octave:send "quit")
75    (set! octave:input-port  #f)
76    (set! octave:output-port #f)
77    (set! octave:pid         #f))
78  ;;; Send a command to Octave
79  (define (octave:send str)
80    (cond ((not octave:output-port)
81           (error "Octave process not started. Start it with (octave:start).\n"))
82          (else
83           (display str octave:output-port))))
84  );;; End Chicken
85
86 ;;;;;;;;;;;;;;;;;;;;;; Gambit ;;;;;;;;;;;;;;;;;;;;;;;
87 (gambit
88  (define (conc . objs)
89    (with-output-to-string 
90      "" (lambda () (display objs))))
91
92  (define (string-intersperse lst between)
93    (if (or (null? lst) 
94            (null? (cdr lst))) 
95        lst
96        (cons (car lst)
97              (cons between 
98                    (string-intersperse (cdr lst) between)))))
99
100  ;;; Start octave process
101  (define (octave:start)
102    (set! octave:input-port 
103          (open-process (list path: "octave"
104                              arguments: (list "-q"))))
105    (set! octave:output-port octave:input-port)
106    (set! octave:pid         #t))
107
108  ;;; Stop octave process
109  (define (octave:stop)
110    (octave:send "quit")
111    (close-input-port  octave:input-port)
112    (close-output-port octave:output-port)
113    (set! octave:input-port  #f)
114    (set! octave:output-port #f)
115    (set! octave:pid         #f))
116
117  ;;; Send a command to Octave
118  (define (octave:send str)
119    (cond ((not octave:output-port)
120           (error "Octave process not started. Start it with (octave:start).\n"))
121          (else
122           (display str octave:output-port)
123           (force-output octave:output-port))))
124  ));;; End Gambit
125
126
127(define (octave:restart)
128  (octave:stop)
129  (octave:start))
130
131
132;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
133;;; some utilities
134(define (list->octave-vector lst)
135  (conc "[" (string-intersperse (map conc lst) " ") "]"))
136
137(define (list->octave-matrix lst)
138  (conc "[" (string-intersperse (map list->octave-vector lst) "; ") "]"))
139
140;;; verify arguments length for 2d plots
141(define (assert-args-lengths args) 
142  (cond ((null? args)
143         #t)
144        ((null? (cdr args))
145         #t)
146        ((string? (cadr args))
147         (assert-args-lengths (cddr args)))
148        ((and (> (length args) 3)
149              (string? (caddr args))
150              (= (length (car  args))
151                 (length (cadr args))))
152         (assert-args-lengths (cdddr args)))
153        ((= (length (car  args))
154            (length (cadr args)))
155         (assert-args-lengths (cddr args)))
156        (else
157         #f)))
158
159(define (args->comma-separated-octave-vectors args)
160  (let ((octave-vectors
161         (map (lambda (arg)
162                (cond ((list? arg)
163                       (list->octave-vector arg))
164                      (else
165                       (conc arg))))
166              args)))
167    (string-intersperse octave-vectors ", ")))
168
169(define (args->comma-separated-octave-matrixes args)
170  (let ((octave-vectors
171         (map (lambda (arg)
172                (cond ((list? arg)
173                       (map list->octave-matrix args))
174                      (else
175                       (conc arg))))
176              args)))
177    (string-intersperse octave-vectors ", ")))
178
179;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
180;;; Plots
181
182;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
183;;; graph lists of numbers in gnuplot using a 2d plot function (e.g.:
184;;; "plot", "loglog", "semilogx")
185(define (octave:generic-2dplot plot-function args)
186  (cond ((null? args)
187         #f)
188        ((not (assert-args-lengths args))
189         (error "vector lengths must match"))
190        (else
191         (octave:send
192          (conc plot-function
193                "(" (args->comma-separated-octave-vectors args) ");\n")))))
194
195;;; some 2d plot functions
196(define (octave:plot     . args) (octave:generic-2dplot "plot"     args))
197(define (octave:semilogx . args) (octave:generic-2dplot "semilogx" args))
198(define (octave:semilogy . args) (octave:generic-2dplot "semilogy" args))
199(define (octave:loglog   . args) (octave:generic-2dplot "loglog"   args))
200(define (octave:polar    . args) (octave:generic-2dplot "polar"    args))
201(define (octave:bar      . args) (octave:generic-2dplot "bar"      args))
202;;; stairs is similar to bar
203(define (octave:stairs   . args) (octave:generic-2dplot "stairs"   args))
204
205(define (octave:errorbar . args) (octave:generic-2dplot "errorbar" args))
206
207
208(define (octave:mesh-xyz . args)
209  (octave:send
210   (conc "mesh "
211          "(" (args->comma-separated-octave-vectors 
212               (take args 2))
213          "," (args->comma-separated-octave-matrixes 
214               (list (list-ref args 2)))
215          ");\n")))
216
217;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
218;;; graph lists of lists of numbers in gnuplot using a 3d plot
219;;; function (e.g.: "mesh")
220(define (octave:generic-3dplot plot-function args)
221  (cond
222   ((null? args)
223    #f)
224   (else
225    (octave:send
226     (conc plot-function
227           "(" (args->comma-separated-octave-matrixes args) ");\n")))))
228
229;;; some 3d plot functions
230(define (octave:mesh     . args) (octave:generic-3dplot "mesh"     args))
231(define (octave:contour  . args) (octave:generic-3dplot "contour"  args))
232(define (octave:imagesc  . args) (octave:generic-3dplot "imagesc"  args))
233
234;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
235;;; new octave figure
236(define (octave:figure)  (octave:send "figure;\n"))
237
238;;; close all figures
239(define (octave:close)  (octave:send "close;\n"))
240(define (octave:close-all)  (octave:send "close all;\n"))
241
242;;; example of wrapper function
243(define (octave:vct-plot . args)
244  (apply octave:plot (map vct->list args)))
245
246;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
247;;; Labels
248
249;;; title, x and y labels
250(define (octave:title  title)  (octave:send (conc "title('"  title  "');\n")))
251(define (octave:xlabel xlabel) (octave:send (conc "xlabel('" xlabel "');\n")))
252(define (octave:ylabel ylabel) (octave:send (conc "ylabel('" ylabel "');\n")))
253
254;;; legend only works with plot, bar
255(define (octave:legend . args) 
256  (define (quote-args args)
257    (conc (string-intersperse
258           (map (lambda (s) (conc "'" s "'")) args)
259           ", ")))
260  (octave:send (conc "legend(" (quote-args args) ");\n")))
261
262;;; grid on/off
263(define (octave:grid . args)
264  (let ((off? (cond ((and (not (null? args)) 
265                          (string=? (car args) "off"))
266                     "off")
267                    (else
268                     ""))))
269    (octave:send (conc "grid " off? ";\n"))))
270
271;;; replot
272(define (octave:replot) 
273  (octave:send "replot;\n"))
274
275;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
276;;; GNUPLOT output file types
277
278;;; set plot output
279(define (octave:set-terminal! output)
280  ;;; __gnuplot_set__ is an internal Octave function that replaces
281  ;;; gset (gset is deprecated)
282  (octave:send (conc "__gnuplot_set__ terminal " output ";\n")))
283
284;;; reset plot output
285(define (octave:reset-terminal!) (octave:set-terminal! "x11"))
286
287;;; set output
288(define (octave:set-output! output)
289  (octave:send (conc "__gnuplot_set__ output " output ";\n")))
290
291;;; set output file
292(define (octave:set-output-file! filename)
293  (octave:set-output! (conc "'" filename "'")))
294
295(define (octave:reset-output!)
296  (octave:set-output! ""))
297
298;;; All File Types supported by gnuplot 4.0 patchlevel 0
299(define octave:supported-file-types
300  (list
301   "aed512" ;;  AED 512 Terminal
302   "aed767" ;;  AED 767 Terminal
303   "aifm" ;;  Adobe Illustrator 3.0 Format
304   "bitgraph" ;;  BBN Bitgraph Terminal
305   "cgm" ;;  Computer Graphics Metafile
306   "corel" ;;  EPS format for CorelDRAW
307   "dumb" ;;  printer or glass dumb terminal
308   "dxf" ;;  dxf-file for AutoCad (default size 120x80)
309   "eepic" ;;  EEPIC -- extended LaTeX picture environment
310   "emf" ;;  Enhanced Metafile format
311   "emtex" ;;  LaTeX picture environment with emTeX specials
312   "epslatex" ;;  LaTeX (Text) and encapsulated PostScript
313   "epson" ;;_180dpi  Epson LQ-style 180-dot per inch (24 pin) printers
314   "epson" ;;_60dpi  Epson-style 60-dot per inch printers
315   "epson" ;;_lx800  Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...
316   "fig" ;;  FIG graphics language for XFIG graphics editor
317   "gif" ;;  GIF format [mode] [fontsize] [size] [colors]
318   "gpic" ;;  GPIC -- Produce graphs in groff using the gpic preprocessor
319   "hp2623A" ;;  HP2623A and maybe others
320   "hp2648" ;;  HP2648 and HP2647
321   "hp500c" ;;  HP DeskJet 500c, [75 100 150 300] [rle tiff]
322   "hpdj" ;;  HP DeskJet 500, [75 100 150 300]
323   "hpgl" ;;  HP7475 and relatives [number of pens] [eject]
324   "hpljii" ;;  HP Laserjet series II, [75 100 150 300]
325   "hppj" ;;  HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]
326   "imagen" ;;  Imagen laser printer
327   "jpeg" ;;  JPEG images using libgd and TrueType fonts
328   "kc" ;;_tek40xx  MS-DOS Kermit Tek4010 terminal emulator - color
329   "km" ;;_tek40xx  MS-DOS Kermit Tek4010 terminal emulator - monochrome
330   "latex" ;;  LaTeX picture environment
331   "mf" ;;  Metafont plotting standard
332   "mif" ;;  Frame maker MIF 3.00 format
333   "mp" ;;  MetaPost plotting standard
334   "nec" ;;_cp6  NEC printer CP6, Epson LQ-800 [monocrome color draft]
335   "okidata" ;;  OKIDATA 320/321 Standard
336   "pbm" ;;  Portable bitmap [small medium large] [monochrome gray color]
337   "pcl5" ;;  HP Designjet 750C, HP Laserjet III/IV, etc. (many options)
338   "png" ;;  PNG images using libgd and TrueType fonts
339   "postscript" ;;  PostScript graphics language [mode "fontname" font_size]
340   "pslatex" ;;  LaTeX picture environment with PostScript \specials
341   "pstex" ;;  plain TeX with PostScript \specials
342   "pstricks" ;;  LaTeX picture environment with PSTricks macros
343   "qms" ;;  QMS/QUIC Laser printer (also Talaris 1200 and others)
344   "regis" ;;  REGIS graphics language
345   "selanar" ;;  Selanar
346   "starc" ;;  Star Color Printer
347   "svg" ;;  W3C Scalable Vector Graphics driver
348   "table" ;;  Dump ASCII table of X Y [Z] values to output
349   "tandy" ;;_60dpi  Tandy DMP-130 series 60-dot per inch graphics
350   "tek40xx" ;;  Tektronix 4010 and others; most TEK emulators
351   "tek410x" ;;  Tektronix 4106, 4107, 4109 and 420X terminals
352   "texdraw" ;;  LaTeX texdraw environment
353   "tgif" ;;  TGIF X11 [mode] [x,y] [dashed] ["font" [fontsize]]
354   "tkcanvas" ;;  Tk/Tcl canvas widget [perltk] [interactive]
355   "tpic" ;;  TPIC -- LaTeX picture environment with tpic \specials
356   "unknown" ;;  Unknown terminal type - not a plotting device
357   "vttek" ;;  VT-like tek40xx terminal emulator
358   "x11" ;;  X11 Window System
359   "X11" ;;  X11 Window System (identical to x11)
360   "xlib" ;;  X11 Window System (gnulib_x11 dump)
361   ))
362
363;;; Use this function to use available file types
364(define (octave:save-plot-to type filename)
365  (define (any proc lst)
366    (cond ((null? lst)      #f)
367          ((proc (car lst)) #t)
368          (else
369           (any proc (cdr lst)))))
370 
371  (define (draw)
372    (octave:set-output-file! filename)
373    (octave:replot)
374    (octave:set-output! "")
375    (octave:reset-terminal!)
376    #t)
377 
378  (cond ((any (lambda (s) (string=? type s))
379              octave:supported-file-types)
380         (octave:set-terminal! type)
381         (draw))
382        (else
383         (error "File type not supported in Octave (see list defined
384in octave:supported-file-types for supported types)."))))
385
386;;; Shortcuts (not really necessary, I will probably remove them)
387(define (octave:save-plot-to-png        filename) (octave:save-plot-to "png"        filename))
388(define (octave:save-plot-to-postscript filename) (octave:save-plot-to "postscript" filename))
389(define (octave:save-plot-to-gif        filename) (octave:save-plot-to "gif"        filename))
390(define (octave:save-plot-to-jpeg       filename) (octave:save-plot-to "jpeg"       filename))
391
392
393;;; OBSOLETE
394;;;;; aed512  AED 512 Terminal
395;;(define (octave:set-terminal-to-aed512!) (octave:set-terminal! "aed512"))
396;;;;; aed767  AED 767 Terminal
397;;(define (octave:set-terminal-to-aed767!) (octave:set-terminal! "aed767"))
398;;;;; aifm  Adobe Illustrator 3.0 Format
399;;(define (octave:set-terminal-to-aifm!) (octave:set-terminal! "aifm"))
400;;;;; bitgraph  BBN Bitgraph Terminal
401;;(define (octave:set-terminal-to-bitgraph!) (octave:set-terminal! "bitgraph"))
402;;;;; cgm  Computer Graphics Metafile
403;;(define (octave:set-terminal-to-cgm!) (octave:set-terminal! "cgm"))
404;;;;; corel  EPS format for CorelDRAW
405;;(define (octave:set-terminal-to-corel!) (octave:set-terminal! "corel"))
406;;;;; dumb  printer or glass dumb terminal
407;;(define (octave:set-terminal-to-dumb!) (octave:set-terminal! "dumb"))
408;;;;; dxf  dxf-file for AutoCad (default size 120x80)
409;;(define (octave:set-terminal-to-dxf!) (octave:set-terminal! "dxf"))
410;;;;; eepic  EEPIC -- extended LaTeX picture environment
411;;(define (octave:set-terminal-to-eepic!) (octave:set-terminal! "eepic"))
412;;;;; emf  Enhanced Metafile format
413;;(define (octave:set-terminal-to-emf!) (octave:set-terminal! "emf"))
414;;;;; emtex  LaTeX picture environment with emTeX specials
415;;(define (octave:set-terminal-to-emtex!) (octave:set-terminal! "emtex"))
416;;;;; epslatex  LaTeX (Text) and encapsulated PostScript
417;;(define (octave:set-terminal-to-epslatex!) (octave:set-terminal! "epslatex"))
418;;;;; epson_180dpi  Epson LQ-style 180-dot per inch (24 pin) printers
419;;(define (octave:set-terminal-to-epson!) (octave:set-terminal! "epson"))
420;;;;; epson_60dpi  Epson-style 60-dot per inch printers
421;;(define (octave:set-terminal-to-epson!) (octave:set-terminal! "epson"))
422;;;;; epson_lx800  Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...
423;;(define (octave:set-terminal-to-epson!) (octave:set-terminal! "epson"))
424;;;;; fig  FIG graphics language for XFIG graphics editor
425;;(define (octave:set-terminal-to-fig!) (octave:set-terminal! "fig"))
426;;;;; gif  GIF format [mode] [fontsize] [size] [colors]
427;;(define (octave:set-terminal-to-gif!) (octave:set-terminal! "gif"))
428;;;;; gpic  GPIC -- Produce graphs in groff using the gpic preprocessor
429;;(define (octave:set-terminal-to-gpic!) (octave:set-terminal! "gpic"))
430;;;;; hp2623A  HP2623A and maybe others
431;;(define (octave:set-terminal-to-hp2623A!) (octave:set-terminal! "hp2623A"))
432;;;;; hp2648  HP2648 and HP2647
433;;(define (octave:set-terminal-to-hp2648!) (octave:set-terminal! "hp2648"))
434;;;;; hp500c  HP DeskJet 500c, [75 100 150 300] [rle tiff]
435;;(define (octave:set-terminal-to-hp500c!) (octave:set-terminal! "hp500c"))
436;;;;; hpdj  HP DeskJet 500, [75 100 150 300]
437;;(define (octave:set-terminal-to-hpdj!) (octave:set-terminal! "hpdj"))
438;;;;; hpgl  HP7475 and relatives [number of pens] [eject]
439;;(define (octave:set-terminal-to-hpgl!) (octave:set-terminal! "hpgl"))
440;;;;; hpljii  HP Laserjet series II, [75 100 150 300]
441;;(define (octave:set-terminal-to-hpljii!) (octave:set-terminal! "hpljii"))
442;;;;; hppj  HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]
443;;(define (octave:set-terminal-to-hppj!) (octave:set-terminal! "hppj"))
444;;;;; imagen  Imagen laser printer
445;;(define (octave:set-terminal-to-imagen!) (octave:set-terminal! "imagen"))
446;;;;; jpeg  JPEG images using libgd and TrueType fonts
447;;(define (octave:set-terminal-to-jpeg!) (octave:set-terminal! "jpeg"))
448;;;;; kc_tek40xx  MS-DOS Kermit Tek4010 terminal emulator - color
449;;(define (octave:set-terminal-to-kc!) (octave:set-terminal! "kc"))
450;;;;; km_tek40xx  MS-DOS Kermit Tek4010 terminal emulator - monochrome
451;;(define (octave:set-terminal-to-km!) (octave:set-terminal! "km"))
452;;;;; latex  LaTeX picture environment
453;;(define (octave:set-terminal-to-latex!) (octave:set-terminal! "latex"))
454;;;;; mf  Metafont plotting standard
455;;(define (octave:set-terminal-to-mf!) (octave:set-terminal! "mf"))
456;;;;; mif  Frame maker MIF 3.00 format
457;;(define (octave:set-terminal-to-mif!) (octave:set-terminal! "mif"))
458;;;;; mp  MetaPost plotting standard
459;;(define (octave:set-terminal-to-mp!) (octave:set-terminal! "mp"))
460;;;;; nec_cp6  NEC printer CP6, Epson LQ-800 [monocrome color draft]
461;;(define (octave:set-terminal-to-nec!) (octave:set-terminal! "nec"))
462;;;;; okidata  OKIDATA 320/321 Standard
463;;(define (octave:set-terminal-to-okidata!) (octave:set-terminal! "okidata"))
464;;;;; pbm  Portable bitmap [small medium large] [monochrome gray color]
465;;(define (octave:set-terminal-to-pbm!) (octave:set-terminal! "pbm"))
466;;;;; pcl5  HP Designjet 750C, HP Laserjet III/IV, etc. (many options)
467;;(define (octave:set-terminal-to-pcl5!) (octave:set-terminal! "pcl5"))
468;;;;; png  PNG images using libgd and TrueType fonts
469;;(define (octave:set-terminal-to-png!) (octave:set-terminal! "png"))
470;;;;; postscript  PostScript graphics language [mode "fontname" font_size]
471;;(define (octave:set-terminal-to-postscript!) (octave:set-terminal! "postscript"))
472;;;;; pslatex  LaTeX picture environment with PostScript \specials
473;;(define (octave:set-terminal-to-pslatex!) (octave:set-terminal! "pslatex"))
474;;;;; pstex  plain TeX with PostScript \specials
475;;(define (octave:set-terminal-to-pstex!) (octave:set-terminal! "pstex"))
476;;;;; pstricks  LaTeX picture environment with PSTricks macros
477;;(define (octave:set-terminal-to-pstricks!) (octave:set-terminal! "pstricks"))
478;;;;; qms  QMS/QUIC Laser printer (also Talaris 1200 and others)
479;;(define (octave:set-terminal-to-qms!) (octave:set-terminal! "qms"))
480;;;;; regis  REGIS graphics language
481;;(define (octave:set-terminal-to-regis!) (octave:set-terminal! "regis"))
482;;;;; selanar  Selanar
483;;(define (octave:set-terminal-to-selanar!) (octave:set-terminal! "selanar"))
484;;;;; starc  Star Color Printer
485;;(define (octave:set-terminal-to-starc!) (octave:set-terminal! "starc"))
486;;;;; svg  W3C Scalable Vector Graphics driver
487;;(define (octave:set-terminal-to-svg!) (octave:set-terminal! "svg"))
488;;;;; table  Dump ASCII table of X Y [Z] values to output
489;;(define (octave:set-terminal-to-table!) (octave:set-terminal! "table"))
490;;;;; tandy_60dpi  Tandy DMP-130 series 60-dot per inch graphics
491;;(define (octave:set-terminal-to-tandy!) (octave:set-terminal! "tandy"))
492;;;;; tek40xx  Tektronix 4010 and others; most TEK emulators
493;;(define (octave:set-terminal-to-tek40xx!) (octave:set-terminal! "tek40xx"))
494;;;;; tek410x  Tektronix 4106, 4107, 4109 and 420X terminals
495;;(define (octave:set-terminal-to-tek410x!) (octave:set-terminal! "tek410x"))
496;;;;; texdraw  LaTeX texdraw environment
497;;(define (octave:set-terminal-to-texdraw!) (octave:set-terminal! "texdraw"))
498;;;;; tgif  TGIF X11 [mode] [x,y] [dashed] ["font" [fontsize]]
499;;(define (octave:set-terminal-to-tgif!) (octave:set-terminal! "tgif"))
500;;;;; tkcanvas  Tk/Tcl canvas widget [perltk] [interactive]
501;;(define (octave:set-terminal-to-tkcanvas!) (octave:set-terminal! "tkcanvas"))
502;;;;; tpic  TPIC -- LaTeX picture environment with tpic \specials
503;;(define (octave:set-terminal-to-tpic!) (octave:set-terminal! "tpic"))
504;;;;; unknown  Unknown terminal type - not a plotting device
505;;(define (octave:set-terminal-to-unknown!) (octave:set-terminal! "unknown"))
506;;;;; vttek  VT-like tek40xx terminal emulator
507;;(define (octave:set-terminal-to-vttek!) (octave:set-terminal! "vttek"))
508;;;;; x11  X11 Window System
509;;(define (octave:set-terminal-to-x11!) (octave:set-terminal! "x11"))
510;;;;; X11  X11 Window System (identical to x11)
511;;(define (octave:set-terminal-to-X11!) (octave:set-terminal! "X11"))
512;;;;; xlib  X11 Window System (gnulib_x11 dump)
513;;(define (octave:set-terminal-to-xlib!) (octave:set-terminal! "xlib"))
514
515
516
517;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
518; TODO: __pltopt__ bar, gplot, gsplot,
519
520
521;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
522;;; test
523;(use srfi-1); (For "iota": in Gambit use your own iota function)
524;(octave:start)
525;(octave:plot '(1 2 3) '(3 2 1))
526;(octave:title "Foo")
527;(octave:xlabel "xbar")
528;(octave:ylabel "ybar")
529;(octave:grid "on")
530;(octave:grid "off")
531;(octave:semilogx '(1 2 3) '(3 2 1))
532;(octave:title "Foo2")
533;(octave:semilogy '(1 2 3) '(3 2 1))
534;(octave:title "Foo3")
535;(octave:figure)
536;(octave:loglog '(1 2 1113) '(3 3.4 2.0) '(1 1.5 211.8) '(2 2.3 21.0)  '(1 1.5 222.3) '(1.2 2.4 2222.0))
537;(octave:figure)
538;(octave:polar (iota 50) (iota 50))
539;(octave:title "Rose")
540;(octave:save-plot-to "png" "rose.png")
541;(octave:figure)
542;(octave:bar (iota 5) (iota 5))
543;(octave:figure)
544;(octave:mesh '((0 1 2 4) (1 2 2 5) (1 3 2 4) (0 2 4 6)))
545;(octave:save-plot-to "ps" "foo.ps")
546;(octave:errorbar (list 1.1 2.1 3.1 4.1) (list 2 3 2 3) (list .1 .2 .2 .1)  (list .1 .2 .2 .2) "'~>'")
547;(octave:errorbar (list 1.1 2.1 3.1 4.1) (list 2 3 2 3) (list .1 .2 .2 .1)  (list .1 .2 .2 .2)  (list .2 .2 .2 .2)  (list .4 .4 .4 .4) "'#~>'")
548;(octave:stop)
549
Note: See TracBrowser for help on using the repository browser.