This tutorial contains brief information on how to install Python Matplotlib on Windows, Linux, and Mac.
Matplotlib Installation
Matplotlib and its various dependency packages come under one Python package called the matplotlib. The following command can install the library for Windows, Linux, and Mac through the pip package manager.
Command:
pip3 install matplotlib
Check Matplotlib Installation
To verify that matplotlib has been successfully installed on your system, execute the following command at the command prompt. If matplotlib has been successfully installed, it will display the version of the installed matplotlib.
Command:
import matplotlib matplotlib.__version__
Output:
3.1.1
Also, Matplotlib demands a large number of dependencies, such as:
- Python 2.7 or above or Python 3.4 or above.
- NumPy
- dateutil
- libpng
- pyparsing
- setuptools
- FreeType
- cycler
- pytz
Installing Anaconda for Matplotlib
Another open-source and accessible tool for performing data analysis using Python and R programming language is the Anaconda. Apart from using it for large-scale data processing, scientific computing, and predictive analytics, it also helps in generating plots using the Matplotlib library.
One can install Anaconda from The link: https://www.anaconda.com/download/
Installing Anaconda is a very straightforward wizard-based process. You can choose between adding Anaconda in the PATH variable and registering Anaconda as your default Python.
Anaconda comes with a Python interpreter.
For installing Anaconda on Linux, you can download any of the installers for your 32-bit or 64-bit system from the downloads page. Then you have to run the following command in the Linux terminal:
Command:
$ bash Anaconda3-5.0.1-Linux-x86_64.sh
Use Jupyter Notebook for Running Matplotlib Plots
Another way to render the Matplotlib library is to use the Jupyter Notebook. This tool supports many languages and their associated libraries. One can simply install Jupyter Notebook using the PIP command:
Command:
pip install jupyterlab
Once installed, you can launch the JupyterLab using the command:
Command:
jupyter-lab
You can run the Jupyter Notebook using the command:
Command:
jupyter notebook
If you do not want to install it in your system but want to use Jupyter Notebook for data analysis, you can run Jupyter Notebook online from this link: https://jupyter.org/try