Free Preview


To download numpy


Matplotlib is a Python library that helps to plot graphs. It is used in data visualization and graphical plotting.

To use matplotlib, we need to install it.

Step 1 − Make sure Python and pip is preinstalled on your system

Type the following commands in the command prompt to check is python and pip is installed on your system.

To check Python

python --version

If python is successfully installed, the version of python installed on your system will be displayed.

To check pip

pip -V

The version of pip will be displayed, if it is successfully installed on your system.

Step 2 − Install Matplotlib

Matplotlib can be installed using pip. The following command is run in the command prompt to install Matplotlib.

pip install matplotlib

This command will start downloading and installing packages related to the matplotlib library. Once done, the message of successful installation will be displayed.

Step 3 − Check if it is installed successfully

To verify that matplotlib is successfully installed on your system, execute the following command in the command prompt. If matplotlib is successfully installed, the version of matplotlib installed will be displayed.

import matplotlib

Matplotlib compiled fine, but nothing shows up when I use it
The first thing to try is a clean install and see if that helps. If not, the best way to test your install is by running a script, rather than working interactively from a python shell or an integrated development environment such as IDLE which add additional complexities. Open up a UNIX shell or a DOS command prompt and run, for example:

                          python -c "from pylab import *; set_loglevel('debug'); plot(); show()"

This will give you additional information about which backends Matplotlib is loading, version information, and more. At this point you might want to make sure you understand Matplotlib's configuration process, governed by the matplotlibrc configuration file which contains instructions within and the concept of the Matplotlib backend.

If you are still having trouble, see Getting help.

To uninstall

     pip uninstall matplotlib

To view matplotlib installed

In PyCharm, open the terminal and do `pip list`, do you see matplotlib? 

Back to: Python Programming (Beginner to Expert) > Python Libraries

Leave a Reply