The initial example of Hello World! for a plotting software is often about showing a simple curve. We will keep up with that tradition. It will also give you a rough idea about how matplotlib works.
You need to have Python (either v2.7 or v3) and matplotlib installed. You also need to have a text editor (any text editor will do) and a command terminal to type and run commands.
Let's get started with one of the most common and basic graph that any plotting software offers—curves. In a text file saved as
plot.py, we have the following code:
import matplotlib.pyplot as plt X = range(100) Y = [value ** 2 for value in X] plt.plot(X, Y) plt.show()
Downloading the example code
You can download the sample code ...