geoPyX v2

texte alternatif


geoPyX is a Python module to build geometrical figures easily. It uses the PyX package, but tries to simplify its syntax. You can easily save your drawing in EPS, PDF and optionnaly PNG format for the Web (in this case, you'll need to install ImageMagick and to add it to your path).

You can here see some geoPyX outputs, just click to see them the right size.


I started geoPyX in August 2006, as I was frustrated by MetaPost and PSTricks limited loops and variables options. The PyX package brings the Adobe PostScript and LaTeX power to the Python community. geoPyX is still quite young and may contain bugs (in such a case, please write me), so use it at your own risk !

The new version has corrected many defaults, but all of the ancient specific classes had to be rewritten now.

For the moment, you can :

The next step is to provide some utility classes to: - trace functions: normals, parametrics, polars ;


In order to make it work, you'll need to install:


geoPyX is under the GPL License.


There will be more samples to come, please wait...


January 18 2007 : A little modifiaction in Segment class and subclasses so that you can now build a Line with 2 Points, or with a Point and a Vector instances. I just started to implement the classes Point3d and Vector3d. But maybe should I write some Matrix classes too, I'll see. For the moment, I'm looking for some tutorials on basic 3d support.

January 15 2007 : Added boxedLabel class.

January 04 2007 : I started rewritting this page, all the thumbnails must have the same size and some ancient source code has nothing to do here right now.

January 03 2007 : The new geoPyX v2.0 Core has been uploaded geoPyXv2. It is still in beta test; I've got problems with the transparency, and in fact it was a PyX bug. I'm waiting for the next update version to provide something convenient. It lacks some classes like Hobby's ones, but I don't want to put it inside untill I find a better way but to use the external Numpy package.

Nethertheless, here's what you can expect:

#! /usr/bin/env python
# -*- coding: iso-8859-1 -*-

from geopyx import *

pyx.unit.set(uscale=1.5) # zoomin by 150%

f = Figure(-8,-8,8,8)

p = Point(6,4)
q = Point(3,-2)
r = Point(1,1)

t1 = Triangle.Pt(p,q,r)
t2 = t1.rotated(0,0,180)

[p1,q1,r1] = t2.coord_list
pto = Point.Middle(p,p1)

f.add(t1, filled='grey9')
f.add(t2, filled='grey6')

for pt in t1.coord_list + t2.coord_list:
    f.add( symbCircle.Pt(pt), filled ='yellow')
    f.add( Segment.Pt(pt, pt.sympt(0,0)), col='red', st='dd')

f.add( codeSegments(pto,p,pto,p1,tn=3), col='red' )
f.add( codeSegments(pto,q,pto,q1,tn=2,angle=-45), col='red' )
f.add( codeSegments(pto,r,pto,r1,tn=1), col='red' )

f.add( Label.Pt(p, r"$P$", angle='n' ) )
f.add( Label.Pt(q, r"$Q$", angle='se' ) )
f.add( Label.Pt(r, r"$R$", angle='w' ) )
f.add( Label.Pt(p1, r"$P'$", angle='s' ) )
f.add( Label.Pt(q1, r"$Q'$", angle='n' ) )
f.add( Label.Pt(r1, r"$R'$", angle='se' ) )
f.add( Label.Pt(pto, r"$O$", angle='n' ) )
f.add( Label(0,-5,r"Central~Symetry"))
f.end('centralsym', png='True')

Affin transforms in action (maybe combined):

centralsym_mini axesym_mini rot_mini homotetie_mini translation_mini

Some work on triangle proprieties with colors and even transparency :

Euler_circle_mini heights_mini bissectors_mini amusements_mini circumcircle_mini

Started some work on parallelograms and translations

parallelogram_mini vectors_1_mini

Some functions

graph1_mini polar1_mini

A more complicated example : here I was obliged to use PyX inside geoPyX


A work in progress : boxedLabels



The latest one : geoPyXv2

Class diagram:

It is hudge (2021x1743), here it is :

diagramme des classes

Documentation & thoughts:

Documentation has still to be written. It will be abble in different output formats, thanks to the reST format.

Limitations & Bugs:


If you have questions, see a bug or need new functionalities, write to kib2[at] Sometimes news will be posted on my blog