FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

merge streamplot_demo_features streamplot_demo_masking streamplot_demo_start_points by patniharshit · Pull Request #8155 · matplotlib/matplotlib · GitHub

Repository navigation

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) All 1 file type selected
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,56 @@
ax2.streamplot(X, Y, U, V, density=0.6, color='k', linewidth=lw)

plt.show()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Remove; there's one at the end.


"""
================================
Streamplot function with masking

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You'll need to merge this docstring with the one at the beginning to make something coherent.

================================

This example shows how streamlines created by the streamplot function skips
masked regions and NaN values.
"""
w = 3
Y, X = np.mgrid[-w:w:100j, -w:w:100j]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can X and Y be reused from above?

U = -1 - X**2 + Y
V = 1 + X - Y**2
speed = np.sqrt(U*U + V*V)

mask = np.zeros(U.shape, dtype=bool)
mask[40:60, 40:60] = True
U[:20, :20] = np.nan
U = np.ma.array(U, mask=mask)

fig, ax = plt.subplots()
ax.streamplot(X, Y, U, V, color='r')

ax.imshow(~mask, extent=(-w, w, -w, w), alpha=0.5,
interpolation='nearest', cmap=plt.cm.gray)

plt.show()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Remove.


"""
========================================
Streamplot function with starting points

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Again, you need to merge this with the first docstring.

========================================

This example shows how to fix the streamlines that are plotted, by passing
an array of seed points to the `start_points` keyword argument.
"""
Y, X = np.mgrid[-3:3:100j, -3:3:100j]
U = -1 - X**2 + Y
V = 1 + X - Y**2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Can any of these be reused from before?


# 5 points along the first diagonal and a point in the left upper quadrant
seed_points = np.array([[-2, -1, 0, 1, 2, -1], [-2, -1, 0, 1, 2, 2]])

fig, ax = plt.subplots()
strm = ax.streamplot(X, Y, U, V, color=U, linewidth=2,
cmap=plt.cm.autumn, start_points=seed_points.T)
fig.colorbar(strm.lines)

ax.plot(seed_points[0], seed_points[1], 'bo')

ax.axis((-3, 3, -3, 3))

plt.show()

This file was deleted.

This file was deleted.


Back | FazBrowse Home | New Git URL