chickadee » plot

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

plot

An interface to the GNU libplot library.

Usage

(require-extension plot)

Documentation

libplot is a part of the GNU plotutils package. It is a 2-D vector graphics library capable of exporting to many file formats, both vector and raster.

The Chicken plot library provides a Scheme interface to a large subset of the libplot procedures. This interface follows closely the libplot API, so the main reference is the plotutils manual.

In libplot, function names are of the form pl_function_r. The Scheme corresponding function name is function.

Below is a list of procedures that are included in this egg, along with brief descriptions. This egg has been tested with plotuils version 2.6.

Data types and constructors

Creating and deleting plotters

Control functions

Object drawing functions

Examples

(use plot)


(define (ccurve plotter  maxorder dx dy order)
  (if (>= order maxorder)
      (fcontrel plotter dx dy)
      (begin
 	(ccurve plotter maxorder
 		(* 0.5 (- dx dy))
		(* 0.5 (+ dx dy))
		(+ order 1))
	(ccurve plotter maxorder
		(* 0.5 (+ dy dx))
		(* 0.5 (- dy dx))
		(+ order 1)))
      ))


(define (simple-test plotter max-order)
  (openpl plotter)
  (fspace plotter 0. 0. 1000. 1000.)
  (flinewidth plotter 0.25 )
  (pencolorname plotter "blue" )
  (erase plotter )
  (fmove plotter 600. 300. )
  (ccurve plotter max-order 0. 400. 0 )
  (closepl plotter)
  )
(define (main)
  (print "libplot version: " (libplot-version))
  (let ((plotter (make-plotter (PNG) (open-output-file "testplot.png") 
			       (list (PAGESIZE "A4") (INTERLACE #t)
				     (X_AUTO_FLUSH #f) (META_PORTABLE #t)))))
    (simple-test plotter 5)
    (delete-plotter plotter)))
(main)
 

About this egg

Author

Ivan Raikov

Version history

1.1
Added matchable and datatype as dependencies (thanks to Mario Domenech Goulart)
1.0
Initial release

License

Copyright 2011 Ivan Raikov.
Based on the Ocamlplot library by Olivier Andrieu.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

A full copy of the GPL license can be found at
<http://www.gnu.org/licenses/>.