Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack. It was introduced by John Hunter in the year 2002.
One of the greatest benefits of visualization is that it allows us visual access to huge amounts of data in easily digestible visuals. Matplotlib consists of several plots like line, bar, scatter, histogram etc.
Windows, Linux and macOS distributions have matplotlib and most of its dependencies as wheel packages. Run the following command to install
matplotlib package :
python -mpip install -U matplotlib
Importing matplotlib :
from matplotlib import pyplot as plt or import matplotlib.pyplot as plt
Basic plots in Matplotlib :
Matplotlib comes with a wide variety of plots. Plots helps to understand trends, patterns, and to make correlations. They’re typically instruments for reasoning about quantitative information. Some of the sample plots are covered here.
Line plot :
Bar plot :
Reference : Matplotlib Documentation.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Matplotlib.colors.rgb_to_hsv() in Python
- Violinplot in Python using axes class of Matplotlib
- Matplotlib.pyplot.broken_barh() in Python
- Matplotlib.ticker.MultipleLocator Class in Python
- Matplotlib.axes.Axes.contourf() in Python
- Matplotlib.axes.Axes.fill() in Python
- matplotlib.axes.Axes.fill_betweenx() in Python
- Matplotlib.gridspec.GridSpec Class in Python
- Matplotlib.pyplot.axis() in Python
- Matplotlib.axis.Axis.get_minorticklines() function in Python
- 3D Wireframe plotting in Python using Matplotlib
- Matplotlib.patches.CirclePolygon class in Python
- Matplotlib.pyplot.get_fignums() in Python
- Python | Matplotlib.pyplot ticks
- Matplotlib.pyplot.waitforbuttonpress() in Python
- Multiplots in Python using Matplotlib
- Matplotlib.axes.Axes.streamplot() in Python
- Matplotlib.axis.Axis.set_figure() function in Python
- Matplotlib.pyplot.streamplot() in Python
- Python | Matplotlib Sub plotting using object oriented API
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.