-
Notifications
You must be signed in to change notification settings - Fork 0
plot
The (plotutils plot)
library gives a low level library for making plots. It is based on the libplot
library in GNU Plotutils. For more specific information on these functions, check the libplot
documentation .
First, make a plotter parameters plparams
object. This holds information about the plot you’re going to make
(newplparams)
: returns a new empty plparams
(setplparam! plp option value)
: add the option
to the plparams object plp
with the value value
For example
(define plotter-params (newplparams))
(setplparam! plotter-params "PAGESIZE" "letter")
Then, make a plotter
object. This is the memory object that you draw on. You have to give it an output port and an error port.
(define file-port (open-output-file "tmp.png"))
(define plotter (newpl "png" file-port (current-error-port) plotter-params))
(openpl! plotter)
newpl
make a new plotter of a given type. Your best choices are "png"
if you want to save a file, or "X"
if you want the drawing to pop up in a window.
Draw on that object
(circle! plotter 100.0 200.0 300.0)
(ellipse! plotter 0 0 30 40 50)
There are many drawing functions
alabel!
arc!
arcrel!
bezier2!
bezier2rel!
bezier3!
bezier3rel!
bgcolor!
bgcolorname!
box!
boxrel!
capmod!
circle!
circlerel!
closepl!
color!
colorname!
concat!
cont!
contrel!
ellarc!
ellarcrel!
ellipse!
ellipserel!
endpath!
endsubpath!
erase!
fillcolor!
fillcolorname!
fillmod!
filltype!
flushpl!
fontname!
fontsize!
havecap
joinmod!
label!
labelwidth!
line!
linerel!
linewidth!
marker!
markerrel!
miterlimit!
move!
moverel!
orientation!
pencolor!
pencolorname!
pentype!
point!
pointrel!
restorestate!
rotate!
savestate!
scale!
setmatrix!
setplparam!
space!
space2!
textangle!
translate!
Render it as a file (or pop it up on the screen if you chose plot type "X"
)
(closepl! plotter)
(close file-port)