Pyplot
Pyplot is a Matplotlib module that provides a MATLAB-like interface. Matplotlib is designed to be as usable as MATLAB, with the ability to use Python and the advantage of being free and open-source. Each pyplot function makes some change to a figure: e.g., creates a figure, creates a plotting area in a figure, plots some lines in a plotting area, decorates the plot with labels, etc. The various plots we can utilize using Pyplot are Line Plot, Histogram, Scatter, 3D Plot, Image, Contour, and Polar.
After knowing a brief about Matplotlib and pyplot let’s see how to create a simple plot.
Example:
Python3
import matplotlib.pyplot as plt # initializing the data x = [ 10 , 20 , 30 , 40 ] y = [ 20 , 25 , 35 , 55 ] # plotting the data plt.plot(x, y) plt.show() |
Output:
Now let see how to add some basic elements like title, legends, labels to the graph.
Note: For more information about Pyplot, refer Pyplot in Matplotlib
Data Visualization using Matplotlib
Data Visualization is the process of presenting data in the form of graphs or charts. It helps to understand large and complex amounts of data very easily. It allows the decision-makers to make decisions very efficiently and also allows them in identifying new trends and patterns very easily. It is also used in high-level data analysis for Machine Learning and Exploratory Data Analysis (EDA). Data visualization can be done with various tools like Tableau, Power BI, Python.
In this article, we will discuss how to visualize data with the help of the Matplotlib library of Python.
Contact Us