| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
| 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() | ||
|
|
||
| """ | ||
| ================================ | ||
| Streamplot function with masking | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityYou'll need to merge this docstring with the one at the beginning to make something coherent.
Sorry, something went wrong.
All reactions
|
||
| ================================ | ||
|
|
||
| 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] | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityCan X and Y be reused from above?
Sorry, something went wrong.
All reactions
|
||
| 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() | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityRemove.
Sorry, something went wrong.
All reactions
|
||
|
|
||
| """ | ||
| ======================================== | ||
| Streamplot function with starting points | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityAgain, you need to merge this with the first docstring.
Sorry, something went wrong.
All reactions
|
||
| ======================================== | ||
|
|
||
| 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 | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityCan any of these be reused from before?
Sorry, something went wrong.
All reactions
|
||
|
|
||
| # 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 |
There was a problem hiding this comment.
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 QualityRemove; there's one at the end.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.