PyX is a Python package for the creation of PostScript and PDF files. You can do all sorts of drawing (lines, arrows, rectangles and so on) and high quality plotting. Have a look at some examples and http://pyx.sourceforge.net/gallery/graphs/index.html.

Here I will collect code snippets I find useful, from trivial to tricky.

Histogram with errorbars

The histogram style gets confused if you add a dy column to your data as you usually do your histogram will get confused. A solution is to use a range style which translates columns named errror to y after the histogram style has done its magic. Thanks André for this.

   1 from pyx import *
   2 
   3 g = graph.graphxy(width=8)
   4 g.plot(graph.data.file("errorbar.dat", x=1, y=2, error=2, derror=3),
   5            [graph.style.histogram(),
   6             graph.style.range(usenames={"y": "error"}), graph.style.errorbar()])
   7 g.writePDFfile("errorbar")

PyX (last edited 2008-04-29 07:51:49 by TimHead)