Matplotlib is a Python library used for plotting. Plots enable us to visualize data in a pictorial or graphical representation.
Matplotlib is a widely used Python based library; it is used to create 2d Plots and graphs easily through Python script, it got another name as a pyplot. By using pyplot, we can create plotting easily and control font properties, line controls, formatting axes, etc.
Matplotlib Tutorial
In this Matplotlib Tutorial, you will learn how to visualize data and new data structures along the way you will master control structures which you will need to customize the flow of your scripts and algorithms.
This tutorial is all about data visualization. Using data, Matplotlib creates 2d Plots and graphs, which is an essential part of data analysis. Recent years we have seen data visualization has got massive demand like never before. Organizations realized that without data visualization it would be challenging them to grow along with the growing completion in the market.
Data visualization is a modern visualization communication. It involves the creation and study of the visual representation of data. Which is used to make the decision-making process and helps to quickly understand the analytics presented visually so everyone can grasp difficult concepts or identify new patterns.
Matplotlib Plot Tutorials
Matplotlib can be used to draw different types of plots. The plot types are:
- Scatter Plot
- Bar Graph
- Histogram
- Pie Plot
- Area Plot
- Hexagonal Bin Plot
Matplotlib Basic Example
Enough with all the theory about Matplotlib. Let use dive into it and create a basic plot with Matplotlib package.
example.py
import matplotlib.pyplot as pyplot
pyplot.plot([1, 2, 3, 4, 5, 6],[4, 5, 1, 3, 6, 7])
pyplot.title('TutorialKart')
pyplot.show()
The first argument to the plot() function, which is a list [1, 2, 3, 4, 5, 6] is taken as horizontal or X-Coordinate and the second argument [4, 5, 1, 3, 6, 7] is taken as the Y-Coordinate or Vertical axis. pyplot.title() function sets the title to the plot. pyplot.show() displays the plot in a window with many options like moving across different plots, panning the plot, zooming, configuring subplots and saving the plot.
