((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/ploticus" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.") (tags "egg")) (section 2 "ploticus" (p "An interface to the ploticus library.") (toc)) (section 2 "Usage" (p "(require-extension ploticus)")) (section 2 "Documentation" (p (link "http://ploticus.sourceforge.net" "ploticus") " is software package for producing plots, charts, and graphics from data, which can generate PNG, GIF, JPEG, PostScript, EPS, SVG and SWF output formats.") (p "The Chicken " (tt "ploticus") " library provides a Scheme interface to the " (tt "ploticus") " procedures.  This interface follows closely the " (tt "ploticus") " API, so the main reference is the " (link "http://ploticus.sourceforge.net/doc/api.html" "ploticus") " manual.") (section 3 "Parameters" (def (sig (procedure " procdebug:: [BOOL] => VOID " (id procdebug))) (p "If this parameter is set to " (tt "#t") ", every line of a ploticus procedure will be printed as it is executed."))) (section 3 "Procedures" (def (sig (procedure " init:: SYMBOL * STRING => INTEGER " (id init))) (p "Initializes " (tt "ploticus") ". The first argument is the output device, which is a symbol that can be one of 'png, 'gif, 'x11, 'svg, 'jpeg, 'eps, or 'swf. (Not all devices may be available, depending on the build.)  The second argument is a string pathname of the file where the result will be written.")) (def (sig (procedure " arg:: STRING [* STRING] => INTEGER " (id arg))) (p "Specifies a " (link "http://ploticus.sourceforge.net/doc/pl.1.html#options" "ploticus command line argument") ".  The first argument specifies the argument name and the second is the argument value. If there is no argument value, the value is passed as empty string. Arguments " (tt "-f") ", " (tt "-prefab") ", and " (tt "-ver") " are not supported. If needed, this procedure should be called after " (tt "init") " but before any other ploticus procedure.")) (def (sig (procedure " execline:: STRING => INTEGER  " (id execline))) (p "Executes one " (link "http://ploticus.sourceforge.net/doc/scripts.html" "ploticus script line") ".") (p "Script lines can contain only these directives: " (tt "#proc") ", " (tt "#procdef") ", " (tt "#endproc") ", " (tt "#clone") " and " (tt "#saveas") ". They cannot contain flow-of-control directives and do not undergo a variable-evaluation pass, so variables cannot be referenced, and select statements (etc.) that reference data field names should use one at sign (@) instead of two (@@).") (p (tt "ploticus") " variables can be accessed by " (tt "getvar") ", described below.") (p "An alternative is to use " (tt "execscript") " (described below) to execute an entire script file. " (tt "execline") " and " (tt "execscript") " cannot be used in the same application.")) (def (sig (procedure " execscript:: STRING => INTEGER  " (id execscript))) (p "Executes an entire " (link "http://ploticus.sourceforge.net/doc/scripts.html" "ploticus script file") ". The argument is the name of a ploticus script file.") (p (tt "execscript") " and " (tt "execline") " cannot be used in the same application.")) (def (sig (procedure " execprefab:: STRING => INTEGER  " (id execprefab))) (p "Executes a " (link "http://ploticus.sourceforge.net/doc/prefabs.html" "ploticus prefab") ".") (p "The argument is the name of the prefab.") (p (tt "execprefab") " and " (tt "execline") " cannot be used in the same application.")) (def (sig (procedure " end:: VOID => INTEGER  " (id end))) (p "Finishes up the plot, writes it to the output file, and frees up allocated memory.")) (def (sig (procedure " getvar:: STRING => STRING " (id getvar))) (p "Returns the contents of the given " (tt "ploticus") " variable name or " (tt "#f") ".")) (def (sig (procedure " setvar:: STRING * STRING => INTEGER " (id setvar))) (p "Sets the contents of the given " (tt "ploticus") " variable name to the given value.")) (def (sig (procedure " proc:: STRING * FIELD-LIST => INTEGER " (id proc))) (p "A convenience procedure for " (tt "#proc") " directives (" (link "http://ploticus.sourceforge.net/doc/scriptsyntax.html#directives" "ploticus procedures") ").") (p "The first arguments is the name of the procedure, the second argument is a list of elements of the form (NAME . VALUE), where " (tt "NAME") " is a field name, and " (tt "VALUE") " is the corresponding field value.")))) (section 2 "Examples" (section 3 "Text annotation" (highlight scheme "(use ploticus)\n \n(init \"svg\" \"chicken.svg\" )\n(arg \"-scale\" \"0.8\")\n(for-each execline\n          '(\"#proc annotate\" \n            \"location: 2 2\" \n            \"text: Chicken\" \n            \"Scheme\" \n            \"\"))\n(end)")) (section 3 "Horizontal bars" (highlight scheme "(use ploticus)\n\n(init \"svg\" \"hbars.svg\")\n\n(define data '((X . 1) (Y . 2) (Z . 3)))\n\n(proc \"getdata\"\n      `((\"data\" . ,@(map (lambda (x) (sprintf \"~S\\t~A\" (car x) (cdr x))) data))))\n\n(proc \"bars\"\n      `((\"horizontalbars\" . \"yes\")\n        (\"color\"          . \"rgb(0,0.5,0.8)\")\n        (\"lenfield\"       . \"2\")\n        (\"barwidth\"       . \"0.3\")\n        (\"labeldetails\"   . \"adjust=0,-0.03 color=rgb(0,0.5,0.8)\")\n        (\"showvalues\"     . \"yes\")\n        ))\n\n(end)"))) (section 2 "About this egg" (section 3 "Author" (p (int-link "/users/ivan-raikov" "Ivan Raikov"))) (section 3 "Version history" (dl (dt "1.1") (dd "Added procdebug parameter") (dt "1.1") (dd "Added proc") (dt "1.0") (dd "Initial release"))) (section 3 "License" (pre "Copyright 2011-2012 Ivan Raikov.") (pre "This program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or (at\nyour option) any later version.\n\nThis program is distributed in the hope that it will be useful, but\nWITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\nGeneral Public License for more details.\n\nA full copy of the GPL license can be found at\n<http://www.gnu.org/licenses/>."))))