FlowGlyph¶
FlowGlyph draws a sequence of polylines as a LineCollection. A per-path values array drives colour (with a colorbar) and a per-path widths array scales the line widths by magnitude.
In [1]:
Copied!
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from cleopatra.flow_glyph import FlowGlyph
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
from cleopatra.flow_glyph import FlowGlyph
1. Colour- and width-scaled flow paths¶
In [2]:
Copied!
t = np.linspace(0, 1, 20)
paths = [np.column_stack([t, np.sin(t * np.pi) + k]) for k in range(6)]
values = np.linspace(10, 60, 6) # colour
widths = np.linspace(1, 8, 6) # line width
fg = FlowGlyph(paths, values=values, widths=widths,
size_legend=True, cmap='magma')
fig, ax, lc = fg.plot(title='Flow paths')
t = np.linspace(0, 1, 20)
paths = [np.column_stack([t, np.sin(t * np.pi) + k]) for k in range(6)]
values = np.linspace(10, 60, 6) # colour
widths = np.linspace(1, 8, 6) # line width
fg = FlowGlyph(paths, values=values, widths=widths,
size_legend=True, cmap='magma')
fig, ax, lc = fg.plot(title='Flow paths')