Recommended Books

Python Matplotlib



Matplotlib is an incredible visualization library in Python. This visualization ability is incredibly useful due to its ability to show huge amounts of data in a visually appealing form. Matplotlib displays using arrays 2-D plots in the form of bar charts, pie charts, scatter plots, histograms and more.

Matplotlib is designed to work with Numpy’s 2-Dimensional arrays. Like Numpy, it is also a library used often in Scientific computing and Statistics. It would be best for you to have some basic Numpy knowledge for Matplotlib. See our Guide on Numpy here.

Installation

Make sure that you have python matplotlib and all it’s dependencies downloaded and installed. If you’re having problems, here’s a link to the Matplotlib documentation for installing it.

Once you’ve installed matplotlib successfully, use the following import statement.

from matplotlib import pyplot

Pyplot

Matplotlib is a massive library with many different uses. We could not hope to cover every aspect of it here. Hence, in this article we will just be dealing with Pyplot, a collection of functions within Matplotlib designed to make it work like MATLAB.

Pyplot is the part of Matplotlib that has most if not all of the plotting functions. In the rest of this guide, we’ll briefly go through the various plotting functions one by one with examples.

Line Plots

A line chart or line graph is a type of chart which displays information as a series of data points called ‘markers’ connected by straight line segments. Line graphs are most often used to find a relationship between two data sets on different axis, X and Y.

Python Matplotlib Line Graph
Line Graph

Scatter Plots

Python Matplotlib Scatter plots are used to plot data points on a horizontal and a vertical axis in the attempt to show how much one variable is affected by another. Best used on large spreads of data to look for co-relations or group points.

CodersLegacy ScatterPlot Matplotlib
Scatter Plots

Histograms

A Python Matplotlib Histogram is able to graphically summarize the distribution of a data set. The keyword here is distribution. A Histogram can also taught of as a frequency table, that records the number of times a value falls within a certain interval (class interval.)

CodersLegacy Matplotlib Histogram
Histogram

Pie charts

The Python Matplotlib Pie chart is a type of data visualization that shows items of varying size in a circle or ‘pie’. The size of the item, or ‘wedge’ is proportional to the sum of all items in the Pie chart.

Pie Chart

This marks the end of the Python matplotlib Article. Any suggestions or contributions for CodersLegacy are more than welcome. Relevant questions concerning the article can be asked in the comments section below.

Leave a Reply

Your email address will not be published. Required fields are marked *