Creating publication-quality geometric figures in Python : <p>I am a mathematician. Recently, I became the editor of the puzzles and problems column for a well-known magazine. Occasionally, I need to create a figure to accompany a problem or solution. These figures mostly relate to 2D (occasionally, 3D) euclidean geometry (lines, polygons, circles, plus the occasional ellipse or other conic section). The goal is obtaining figures of very high quality (press-ready), with Computer Modern ("TeX") textual labels. My hope is finding (or perhaps helping write!) a relatively high-level Python library that "knows" euclidean geometry in the sense that natural operations (e.g., drawing a perpendicular line to a given one passing through a given point,  bisecting a given angle, or reflecting a figure A on a line L to obtain a new figure A') are already defined in the library. Of course, the ability to create figures after their elements are defined is a crucial goal (e.g., as Encapsulated Postscript).</p>

<p>I know multiple sub-optimal solutions to this problem (some partial), but I don't know of any that is both simple and flexible. Let me explain:</p>

<ul>
<li><a href="http://asymptote.sourceforge.net/" rel="noreferrer">Asymptote</a> (similar to/based on <a href="https://www.tug.org/metapost.html" rel="noreferrer">Metapost</a>) allows creating extremely high-quality figures of great complexity, but knows almost nothing about geometric constructions (it is a rather low-level language) and thus any nontrivial construction requires quite a long script.</li>
<li><a href="http://www.texample.net/tikz/" rel="noreferrer">TikZ</a> with package <a href="https://www.ctan.org/pkg/tkz-euclide" rel="noreferrer">tkz-euclide</a> is high-level, flexible and also generates quality figures, but its syntax is so heavy that I just cry for Python's simplicity in comparison. (Some programs actually export to TikZ---see below.)</li>
<li>Dynamic Geometry programs, of which I'm most familiar with <a href="http://www.geogebra.org/" rel="noreferrer">Geogebra</a>, often have figure-exporting features (EPS, TikZ, etc.), but are meant to be used interactively. Sometimes, what one needs is a figure based on hard specs (e.g., exact side lengths)---defining objects in a script is ultimately more flexible (if correspondingly less convenient).</li>
<li>Two programs, <a href="http://www.eukleides.org/" rel="noreferrer">Eukleides</a> and <a href="http://poincare.matf.bg.ac.rs/~janicic//gclc/" rel="noreferrer">GCLC</a>, are closest to what I'm looking for: They generate figures (EPS format; GCLC also exports to TikZ). Eukleides has the prettiest, simplest syntax of all the options (see the <a href="http://www.eukleides.org/samples.html" rel="noreferrer">examples</a>), but it happens to be written in C (with source available, though I'm not sure about the license), rather limited/non-customizable, and no longer maintained. GCLC is still maintained but it is closed-source, its syntax is significantly worse than Eukleides's, and has certain other unnatural quirks. Besides, it is not available for Mac OS (my laptop is a Mac).</li>
</ul>

<p>Python has:</p>

<ul>
<li><a href="http://matplotlib.org/" rel="noreferrer">Matplotlib</a>, which produces extremely high-quality figures (particularly of functions or numerical data), but does not seem to know about geometric constructions, and</li>
<li><a href="http://www.sympy.org" rel="noreferrer">Sympy</a> has a geometry module which <em>does</em> know about geometric objects and constructions, all accessible in delightful Python syntax, but seems to have no figure-exporting (or even displaying?) capabilities.</li>
</ul>

<p>Finally, a question: Is there a library, something like "Figures for Sympy/geometry", that uses Python syntax to describe geometric objects and constructions, allowing to generate high-quality figures (primarily for printing, say EPS)?</p>

<p>If a library with such functionality does not exist, I would consider helping to write one (perhaps an extension to Sympy?). I will appreciate pointers.</p>
