Skip to content

Section 2: Graphing

HussuBro010 edited this page Nov 2, 2024 · 3 revisions

Graphing

in pryttier.graphing

This module makes plotting graphs a lot easier. It uses matplotlib. The code is a lot more readable and appealing.

Creating A Graph

Creating a graph is simple. The below code creates a 2D graph:

graph = Graph2D()
graph.addAxes()

graph.show()

Let's break the down the above code:

The first line creates an instance of class Graph2d. It has 2 parameters (optional): name and style. The name is pretty self-explanatory. We will talk about style later.

The second line adds a 2d axes to the figure

The last line finally shows the graph. All the graphing and plotting stuff will be between the second line and the last line.

Let's look at what can we graph.

Clone this wiki locally