8000 Return arrow collection as 2nd argument of streamplot. by tonysyu · Pull Request #803 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Return arrow collection as 2nd argument of streamplot. #803

New issue

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

Merged
merged 4 commits into from
Sep 2, 2012
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Return arrow collection as 2nd argument of streamplot.
  • Loading branch information
tonysyu committed Sep 2, 2012
commit 391c24ae0dde742715f24ba1f13581c930e62c8e
2 changes: 1 addition & 1 deletion lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3055,7 +3055,7 @@ def streamplot(x, y, u, v, density=1, linewidth=None, color=None, cmap=None,
draw_if_interactive()
finally:
ax.hold(washold)
sci(ret)
sci(ret[0])
return ret

# This function was autogenerated by boilerplate.py. Do not edit as
Expand Down
6 changes: 5 additions & 1 deletion lib/matplotlib/streamplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
cmap = cm.get_cmap(cmap)

streamlines = []
arrows = []
for t in trajectories:
tgx = np.array(t[0])
tgy = np.array(t[1])
Expand Down Expand Up @@ -139,6 +140,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
transform=transform,
**arrow_kw)
axes.add_patch(p)
arrows.append(p)

lc = mcollections.LineCollection(streamlines,
transform=transform,
Expand All @@ -151,7 +153,9 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,

axes.update_datalim(((x.min(), y.min()), (x.max(), y.max())))
axes.autoscale_view(tight=True)
return lc

arrow_collection = matplotlib.collections.PatchCollection(arrows)
return lc, arrow_collection


# Coordinate definitions
Expand Down
0