Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a97d058

Browse files
committed
Clean up and move streamplot demos
1 parent 8ecd20d commit a97d058

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

doc/users/whats_new.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ In addition to simply plotting the streamlines of the vector field,
295295
line widths of the streamlines to a separate parameter, such as the speed or
296296
local intensity of the vector field.
297297

298-
.. plot:: mpl_examples/pylab_examples/streamplot_demo.py
298+
.. plot:: mpl_examples/images_contours_and_fields/streamplot_demo_features.py
299299

300300

301301
New hist functionality

examples/pylab_examples/streamplot_demo.py renamed to examples/images_contours_and_fields/streamplot_demo_features.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
"""
2+
Demo of the `streamplot` function.
3+
4+
A streamplot, or streamline plot, is used to display 2D vector fields. This
5+
example shows a few features of the stream plot function:
6+
7+
* Varying the color along a streamline.
8+
* Varying the density of streamlines.
9+
* Varying the line width along a stream line.
10+
"""
111
import numpy as np
212
import matplotlib.pyplot as plt
313

examples/pylab_examples/streamplot_with_mask.py renamed to examples/images_contours_and_fields/streamplot_demo_masking.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"""
2-
Demonstrate the use of the `streamplot` function using a masked array
3-
and NaN values.
2+
Demo of the streamplot function with masking.
3+
4+
This example shows how streamlines created by the streamplot function skips
5+
masked regions and NaN values.
46
"""
57
import numpy as np
68
import matplotlib.pyplot as plt
@@ -17,7 +19,9 @@
1719
U[:20, :20] = np.nan
1820

1921
plt.streamplot(X, Y, U, V, color='r')
20-
plt.imshow(~mask, extent=(-w, w, -w, w), alpha=0.5, interpolation='nearest')
22+
23+
plt.imshow(~mask, extent=(-w, w, -w, w), alpha=0.5,
24+
interpolation='nearest', cmap=plt.cm.gray)
2125

2226
plt.show()
2327

0 commit comments

Comments
 (0)