Into AI

Into AI

Share this post

Into AI
Into AI
5 Matplotlib Methods That You Never Knew Existed
Copy link
Facebook
Email
Notes
More

5 Matplotlib Methods That You Never Knew Existed

1. quiver

Dr. Ashish Bamania's avatar
Dr. Ashish Bamania
Jan 24, 2024
∙ Paid

Share this post

Into AI
Into AI
5 Matplotlib Methods That You Never Knew Existed
Copy link
Facebook
Email
Notes
More
Share
Generated with DALL-E 3

1. quiver

The quiver method is used to plot vector fields in matplotlib.

A vector field is a mathematical model of the magnitude and direction of different vectors in a 2D or 3D space.

Thanks for reading Byte Surgery! Subscribe for free to receive new posts and support my work.

These are used to represent different physical quantities like:

  • Electromagnetic fields

  • Fluid dynamics, and more

How To Use?

quiver([X, Y], U, V, [C], **kwargs)

The parameters passed to this method are as follows:

  • X, Y: define the x and y coordinates of the arrow locations

  • U, V: define the x and y direction components of the arrow vectors/directions

  • C: sets the colour of the arrows

Example Plot

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 2*np.pi, 20)
y = np.linspace(0, 2*np.pi, 20)

# Starting positions of the vectors in the vector field
X, Y = np.meshgrid(x, y)

# Horizontal component of the vectors 
U = np.cos(X)

# Vertical component of the vectors
V = np.sin(Y)

plt.quiver…

Keep reading with a 7-day free trial

Subscribe to Into AI to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Dr. Ashish Bamania
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More