Member-only story
Graphs in generativepy
generativepy is an open-source Python drawing library, mainly intended for maths/science illustrations and animations. It can be found on github.
The graph module provides methods for plotting 2D graphs, mainly line graphs. Of course, Python has many good plotting libraries, including matplotlib and others. Many of them give very good results and support many different types of plots. So why does generativepy include a graphing module of its own? There are several reasons:
- If you use generativepy to create maths diagrams, it is convenient to be able to create graphs using the same library.
- If you need to add annotations to your graphs, you can do it using the same drawing techniques you use to create other maths diagrams.
- If you use generativepy to create videos or animated GIFs, it is easy to add animated graphs to those.
Graphs are just objects on the page, which allows for various advanced drawing options. For example, you can use graphs as sub-elements of another graph, like this:
In this article, we cover basic graphs. We will cover more advanced options in a later article.
Simple axes
A generativepy graph consists of two or more separate objects:
- The graph axes, an
Axesobject. This…









