\documentclass{article} \usepackage{axiom} \begin{document} \title{\$SPAD/src/input plotfile.input} \author{The Axiom Team} \maketitle \begin{abstract} \end{abstract} \eject \tableofcontents \eject \section{License} <>= --Copyright The Numerical Algorithms Group Limited 1994. @ <<*>>= <> --Here is an input file which will plot a list of 2d data from a file. )clear all g := graphImage()$GRIMAGE p1 := point [0,0]$(Point DoubleFloat) p2 := point [.25,.25]$(Point DoubleFloat) p3 := point [.5,.5]$(Point DoubleFloat) p4 := point [.75,.75]$(Point DoubleFloat) p5 := point [1,1]$(Point DoubleFloat) component(g,p1)$GRIMAGE component(g,p2)$GRIMAGE appendPoint(g,p3)$GRIMAGE appendPoint(g,p4)$GRIMAGE appendPoint(g,p5)$GRIMAGE g1 := makeGraphImage(g)$GRIMAGE makeViewport2D(g1,[title("Graph Points")])$VIEW2D -- This line is equivalent to using component(g2,pi) for each point g2 := coerce([[p1],[p2],[p3],[p4],[p5]])$GRIMAGE v := viewport2D()$VIEW2D options(v,[title("Just Points")]) putGraph(v,g2,1) makeViewport2D(v)$VIEW2D --------------------------------------------- -- Create a 2d viewport of a list of points from a file --------------------------------------------- drawList(lp:List Point DoubleFloat):VIEW2D == n := #lp g := graphImage()$GRIMAGE for p in lp repeat point(g,p,pointColorDefault())$GRIMAGE -- component(g,p,pointColorDefault(),lineColorDefault(),pointSizeDefault())$GRIMAGE gi := makeGraphImage(g)$GRIMAGE makeViewport2D(gi,[title("Points")])$VIEW2D plotData2D(name, title) == f:File(DoubleFloat) := open(name,"input") lp:LIST(Point DoubleFloat) := empty() while ((x := readIfCan!(f)) case DoubleFloat) repeat y : DoubleFloat := read!(f) lp := cons(point [x,y]$(Point DoubleFloat), lp) lp close!(f) drawList(lp) --plotData(``file.data'', ``2D Data Plot'') )clear all drawFun(f:DoubleFloat->DoubleFloat):VIEW2D == g := graphImage()$GRIMAGE lp : LIST(Point DoubleFloat) := empty() for i in 1..10 repeat lp := cons(point [i, f(i)]$(Point DoubleFloat), lp) component(g, lp, pointColorDefault(), lineColorDefault(), pointSizeDefault()) gi := makeGraphImage(g)$GRIMAGE makeViewport2D(gi, [title("Points")])$VIEW2D @ \eject \begin{thebibliography}{99} \bibitem{1} nothing \end{thebibliography} \end{document}