Matplotlib is a plotting library for python. Matplotlib was originally written by John D Hunter during his post-doctoral research in neurobiology to visualize electrocorticography (ECoG) data of epilepsy patients. Then Michael Droettboom lead the development project after John Hunter passed away in August 2012.
Matplotlib version 2.0.x support python version 2.7 – 3.6.
Starting 2020, Matplotlib does not support python 2 anymore.
Using Matplotlib with python is easy.
I will show you how to visualize a simple graph.
In this tutorial, I use IDLE as python editor.
If you don’t have it, you can install using command below from your Linux Terminal.
$ sudo apt-get install idle
Run the idle.
From menu, select File>New File to display the Editor.
Type the code below and press F5 to run the code.
import matplotlib.pyplot as plt x=[1,2,3,4] y=[5,6,7,8] plt.plot(x,y) plt.show()
You have your first graph with Matplotlib.
It’s easy, right?
(more…)