- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

Matplotlib is a popular Python package that is used for data visualization. Visualizing data is an important steps since it helps understand what is going on in the data without actually looking at the numbers and performing complicated computations. It helps in communicating the quantitative insights to the audience effectively.

Matplotlib is used to create 2 dimensional plots with the data. It comes with an object oriented API that helps in embedding the plots in Python applications. Matplotlib can be used with IPython shells, Jupyter notebook, Spyder IDE and so on.

It is written in Python. It is created using Numpy, which is the Numerical Python package in Python.

Python can be installed on Windows using the below command −

pip install matplotlib

The dependencies of Matplotlib are −

Python ( greater than or equal to version 3.4) NumPy Setuptools Pyparsing Libpng Pytz Free type Six Cycler Dateutil

A quiver plot is used to display velocity vectors as arrays that have components (u , v) at points (x , y) respectively. It can be created using the below command −

quiver(x,y,u,v, color)

Here, ‘x’, ‘y’, ‘u’ and ‘v’ can be coordinates of 1−D or 2−D sequence of data

Let us understand how Matplotlib can be used to create quiver plot −

import numpy as np import matplotlib.pyplot as plt x = np.arange(0, 5.4, 0.5) y = np.arange(0, 5.4, 0.5) X, Y = np.meshgrid(x, y) u = np.cos(X)*Y v = np.sin(Y)*Y fig, ax = plt.subplots(figsize =(12, 8)) ax.quiver(X, Y, u, v) ax.xaxis.set_ticks([]) ax.yaxis.set_ticks([]) ax.axis([−0.7, 2.7, −0.7, 2.7]) ax.set_aspect('equal') plt.show()

The required packages are imported, and aliased.

The data is generated using NumPy library.

The sine and cos functions are defined.

The size of the plot is defined.

The ‘quiver’ function present in Matplotlib is called.

The ‘show’ function is used to display the plot.

- Related Questions & Answers
- How to make a quiver plot in polar coordinates using Matplotlib?
- Explain how Matplotlib can be used to create a wireframe plot in Python?
- Explain how a violin plot can be visualized using factorplot function in Python?
- Explain how a sequential model (Dense Layer) be built in Tensorflow using Python
- How can Matplotlib be used to create three-dimensional scatter plot using Python?
- How can Matplotlib be used to create 3 dimensional contour plot using Python?
- How can Tensorflow be used to export the model built using Python?
- How can Tensorflow be used to export the built model using Python?
- How can a sequential model be built on Auto MPG using TensorFlow?
- How can I make the xtick labels of a plot be simple drawings using Matplotlib?
- How can a sequential model be built on Auto MPG dataset using TensorFlow?
- How can matplotlib be used to create histograms using Python?
- How can Keras be used to plot the model using Python?
- How can Bokeh be used to generate scatter plot using Python?
- How can Tensorflow be used to plot the results using Python?

Advertisements