# Matplotlib Plotting Tutorials
# Quiverplots

import numpy as np
import matplotlib.pyplot as plt

def vander_pol_oscillator(m, x, y):
    u, v = m*(x - x**3/3 - y), x/m
    return u, v

# half length of dimension in x and y axis
l = 8.0

# no. of points along x/y axis
n = 101

# Parameter
mu = 0.5

# X and Y dimensions
x1 = np.linspace(-l, l, n)
x2 = np.linspace(-l, l, n)

# Creating a mesh field
X1, X2 = np.meshgrid(x1, x2)

# Calculating velocities
U, V = vander_pol_oscillator(mu, X1, X2)

# Resultant velocity
vels = np.hypot(U, V)

# Slice interval for quiver
slice_interval = 4

# Slicer index for smoother quiver plot
# General note: Adjust the slice interval and scale accordingly to get the required arrow size.
# Also, the units, and angles units are also responsible.
skip = (slice(None, None, slice_interval), slice(None, None, slice_interval))

plt.figure()
Quiver = plt.quiver(X1[skip], X2[skip],
                    U[skip], V[skip],
                    vels[skip],
                    units='height',
                    angles='uv',
                    scale=250,
                    pivot='mid',
                    # color='blue',
                    cmap=plt.cm.seismic
                    )
plt.title("Van der pol Phase Portrait")
plt.xlabel("x")
plt.ylabel("y")
plt.quiverkey(Quiver, 1.01, 1.01, 10, label='10m/s', labelcolor='blue', labelpos='N',
                   coordinates='axes')
plt.colorbar(Quiver)
plt.xticks()
plt.yticks()
plt.axis([-l, l, -l, l])
plt.grid()
plt.show()

ef5288c1d921477e85ca3d7759fdd7698a207c2e
<mask token>


def vander_pol_oscillator(m, x, y):
    u, v = m * (x - x ** 3 / 3 - y), x / m
    return u, v


<mask token>

<mask token>


def vander_pol_oscillator(m, x, y):
    u, v = m * (x - x ** 3 / 3 - y), x / m
    return u, v


<mask token>
plt.figure()
<mask token>
plt.title('Van der pol Phase Portrait')
plt.xlabel('x')
plt.ylabel('y')
plt.quiverkey(Quiver, 1.01, 1.01, 10, label='10m/s', labelcolor='blue',
    labelpos='N', coordinates='axes')
plt.colorbar(Quiver)
plt.xticks()
plt.yticks()
plt.axis([-l, l, -l, l])
plt.grid()
plt.show()

<mask token>


def vander_pol_oscillator(m, x, y):
    u, v = m * (x - x ** 3 / 3 - y), x / m
    return u, v


l = 8.0
n = 101
mu = 0.5
x1 = np.linspace(-l, l, n)
x2 = np.linspace(-l, l, n)
X1, X2 = np.meshgrid(x1, x2)
U, V = vander_pol_oscillator(mu, X1, X2)
vels = np.hypot(U, V)
slice_interval = 4
skip = slice(None, None, slice_interval), slice(None, None, slice_interval)
plt.figure()
Quiver = plt.quiver(X1[skip], X2[skip], U[skip], V[skip], vels[skip], units
    ='height', angles='uv', scale=250, pivot='mid', cmap=plt.cm.seismic)
plt.title('Van der pol Phase Portrait')
plt.xlabel('x')
plt.ylabel('y')
plt.quiverkey(Quiver, 1.01, 1.01, 10, label='10m/s', labelcolor='blue',
    labelpos='N', coordinates='axes')
plt.colorbar(Quiver)
plt.xticks()
plt.yticks()
plt.axis([-l, l, -l, l])
plt.grid()
plt.show()

import numpy as np
import matplotlib.pyplot as plt


def vander_pol_oscillator(m, x, y):
    u, v = m * (x - x ** 3 / 3 - y), x / m
    return u, v


l = 8.0
n = 101
mu = 0.5
x1 = np.linspace(-l, l, n)
x2 = np.linspace(-l, l, n)
X1, X2 = np.meshgrid(x1, x2)
U, V = vander_pol_oscillator(mu, X1, X2)
vels = np.hypot(U, V)
slice_interval = 4
skip = slice(None, None, slice_interval), slice(None, None, slice_interval)
plt.figure()
Quiver = plt.quiver(X1[skip], X2[skip], U[skip], V[skip], vels[skip], units
    ='height', angles='uv', scale=250, pivot='mid', cmap=plt.cm.seismic)
plt.title('Van der pol Phase Portrait')
plt.xlabel('x')
plt.ylabel('y')
plt.quiverkey(Quiver, 1.01, 1.01, 10, label='10m/s', labelcolor='blue',
    labelpos='N', coordinates='axes')
plt.colorbar(Quiver)
plt.xticks()
plt.yticks()
plt.axis([-l, l, -l, l])
plt.grid()
plt.show()

# Matplotlib Plotting Tutorials
# Quiverplots

import numpy as np
import matplotlib.pyplot as plt

def vander_pol_oscillator(m, x, y):
    u, v = m*(x - x**3/3 - y), x/m
    return u, v

# half length of dimension in x and y axis
l = 8.0

# no. of points along x/y axis
n = 101

# Parameter
mu = 0.5

# X and Y dimensions
x1 = np.linspace(-l, l, n)
x2 = np.linspace(-l, l, n)

# Creating a mesh field
X1, X2 = np.meshgrid(x1, x2)

# Calculating velocities
U, V = vander_pol_oscillator(mu, X1, X2)

# Resultant velocity
vels = np.hypot(U, V)

# Slice interval for quiver
slice_interval = 4

# Slicer index for smoother quiver plot
# General note: Adjust the slice interval and scale accordingly to get the required arrow size.
# Also, the units, and angles units are also responsible.
skip = (slice(None, None, slice_interval), slice(None, None, slice_interval))

plt.figure()
Quiver = plt.quiver(X1[skip], X2[skip],
                    U[skip], V[skip],
                    vels[skip],
                    units='height',
                    angles='uv',
                    scale=250,
                    pivot='mid',
                    # color='blue',
                    cmap=plt.cm.seismic
                    )
plt.title("Van der pol Phase Portrait")
plt.xlabel("x")
plt.ylabel("y")
plt.quiverkey(Quiver, 1.01, 1.01, 10, label='10m/s', labelcolor='blue', labelpos='N',
                   coordinates='axes')
plt.colorbar(Quiver)
plt.xticks()
plt.yticks()
plt.axis([-l, l, -l, l])
plt.grid()
plt.show()
