Department of Mathematics FAS Harvard University One Oxford Street Cambridge MA 02138 USA Tel: (617) 495-2171 Fax: (617) 495-5132
FAS Computer Services to Harvard University IT: (617) 495-7777.


Asymptote is a vector graphics language. It is part of most linux distributions. (sudo apt-get install asymptote). It is motivated by MetaFont and Metapost. Here is how to use it from the command line: Assume we have a file square.asy which has the content
size(3cm);
draw(unitsquare);
label(" ,(0,0),SW);
label(" ,(1,0),SE);
label(" ,(1,1),NE);
label(" ,(0,1),NW);
fill(shift(4,0)*rotate(30)*P, yellow);
then the following command
asy square.asy 
produces an EPS file, which can be included into a Latex document. Here is an other example on how to graph:
size(10cm);
import graph; 
real f(real x) { 
    return x*sin(10*1/(0.001+x^2)); 
}
draw(graph(f,-3,3,300),blue);
Here is a fancy example from the documentation:
size(600); real a=5; real b=12; real c=hypot(a,b);
transform ta=shift(c,c)*rotate(-aCos(a/c))*scale(a/c)*shift(-c);
transform tb=shift(0,c)*rotate(aCos(b/c))*scale(b/c);
picture Pythagorean(int n) {
  picture pic;
  fill(pic,scale(c)*unitsquare,1/(n+1)*red+n/(n+1)*green);
  if(n == 0) return pic;
  picture branch=Pythagorean(--n);
  add(pic,ta*branch); add(pic,tb*branch);
  return pic;
}
add(Pythagorean(12));


Links:




Simplicity, Clarity, Generality B.W. Kernighan, R. Pike, in "The Practice of Programming".
Privacy Digital Accessibility
HTML CSS