So it turns out that I couldn’t find a good library to draw Cartesian coordinates, points, lines, vectors, and all sorts of geometric figures in Python. Also, when I first wrote this blog post, I thought almost no one would ever read it – because who wants to draw Cartesian coordinates in Python? But it turns out that there are thousands of you out there who did find it useful 😮 (mind = blown) … So I ended up organizing all these scripts into a library.
It is hosted on pip – so everybody can use it – and it’s called pyGeom2D.
Here is how you would draw a Cartesian coordinate system with pyGeom2D.
Â
Step 1: Install pyGeom2D like any other Python library
pip install pyGeom2D
Â
Step 2: Draw your Cartesian coordinate system
from pygeom import Axes, Point # Create the cartesian axis axes = Axes(xlim=(-5,5), ylim=(-5,5), figsize=(9,8)) axes.draw()
Â
Not so bad, right? 😀
For more details on the other capabilities of PyGeom2D, the github repository is here. I am planning to add more features as time goes by but my schedule is a bit crazy so please free to fork, merge request, etc. The more the merrier!