Installing Matplotlib for Python


Mathplotlib is according to their website "a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms." But, I simply use it for plotting normal graphs right now on Python, so my simple definition is that it just creates graphs.

In my opinion, downloading it is pretty straight forward and if anything you can just copy and paste what I wrote. All you are going to need is a wifi connection, and Visual Studio Code.

Mac (In terminal):
pip3 install matplotlib 

Window (In Visual Studio Code Terminal)
python -m pip install -U pip setuptools

then python -m pip install matplotlib





Running Matplotlib on Visual Studio Code
When using Matplotlib, there are a few things you need to know. First of all, you need to add at the beginning of your code import matplotlib.pyplot as plt. This line of code acts as an indicator to Python that you want to use mathplotlib. To plot anything you need to type plt.plot([1,2,3]), and to display you need plt.show().
Those, are the essential things you need to know. Of course you can add a title (plt.title("")), and then name the axis (plt.xlabel('') and plt.xlabel('')). There are probably way more features that I don't yet know about, and I would highly recommend you check it out:  https://matplotlib.org/api/pyplot_summary.html






Comments

Popular Posts