|
4 | 4 | """
|
5 | 5 | import numpy as np
|
6 | 6 | import matplotlib
|
| 7 | +import matplotlib.cm as cm |
| 8 | +import matplotlib.colors as mcolors |
| 9 | +import matplotlib.collections as mcollections |
7 | 10 | import matplotlib.patches as patches
|
8 | | -from matplotlib.cm import get_cmap |
9 | 11 |
|
10 | 12 | __all__ = ['streamplot']
|
11 | 13 |
|
@@ -103,11 +105,11 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
|
103 | 105 |
|
104 | 106 | if use_multicolor_lines:
|
105 | 107 | if norm is None:
|
106 | | - norm = matplotlib.colors.normalize(color.min(), color.max()) |
| 108 | + norm = mcolors.normalize(color.min(), color.max()) |
107 | 109 | if cmap is None:
|
108 | | - cmap = get_cmap(matplotlib.rcParams['image.cmap']) |
| 110 | + cmap = cm.get_cmap(matplotlib.rcParams['image.cmap']) |
109 | 111 | else:
|
110 | | - cmap = get_cmap(cmap) |
| 112 | + cmap = cm.get_cmap(cmap) |
111 | 113 |
|
112 | 114 | streamlines = []
|
113 | 115 | for t in trajectories:
|
@@ -139,7 +141,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
|
139 | 141 | p = patches.FancyArrowPatch(arrow_tail, arrow_head, **arrow_kw)
|
140 | 142 | axes.add_patch(p)
|
141 | 143 |
|
142 | | - lc = matplotlib.collections.LineCollection(streamlines, **line_kw) |
| 144 | + lc = mcollections.LineCollection(streamlines, **line_kw) |
143 | 145 | if use_multicolor_lines:
|
144 | 146 | lc.set_array(np.asarray(line_colors))
|
145 | 147 | lc.set_cmap(cmap)
|
|
0 commit comments