VectorGlyph¶
VectorGlyph renders a 2-D (u, v) field over (x, y) positions as arrows (quiver), wind barbs (barbs), or streamlines (streamplot), coloured by the per-vector magnitude hypot(u, v).
In [1]:
Copied!
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from cleopatra.vector_glyph import VectorGlyph
x, y = np.meshgrid(np.linspace(0, 1, 10), np.linspace(0, 1, 10))
u, v = np.cos(x * np.pi), np.sin(y * np.pi)
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from cleopatra.vector_glyph import VectorGlyph
x, y = np.meshgrid(np.linspace(0, 1, 10), np.linspace(0, 1, 10))
u, v = np.cos(x * np.pi), np.sin(y * np.pi)
1. Arrows (quiver)¶
In [2]:
Copied!
vg = VectorGlyph(x, y, u, v, cmap='viridis')
fig, ax, artist = vg.plot(kind='quiver', title='Quiver')
vg = VectorGlyph(x, y, u, v, cmap='viridis')
fig, ax, artist = vg.plot(kind='quiver', title='Quiver')
2. Streamlines¶
In [3]:
Copied!
vg = VectorGlyph(x, y, u, v, cmap='cool')
fig, ax, stream = vg.plot(kind='streamplot', title='Streamlines')
vg = VectorGlyph(x, y, u, v, cmap='cool')
fig, ax, stream = vg.plot(kind='streamplot', title='Streamlines')