Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit25ba160

Browse files
committed
streamcontainer
1 parentf975291 commit25ba160

File tree

1 file changed

+34
-13
lines changed

1 file changed

+34
-13
lines changed

‎lib/matplotlib/streamplot.py

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
importmatplotlibasmpl
99
frommatplotlibimport_api,cm,patches
10+
frommatplotlib.containerimportContainer
1011
importmatplotlib.colorsasmcolors
1112
importmatplotlib.collectionsasmcollections
1213
importmatplotlib.linesasmlines
@@ -76,17 +77,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
7677
7778
Returns
7879
-------
79-
StreamplotSet
80-
Container object with attributes
81-
82-
- ``lines``: `.LineCollection` of streamlines
83-
84-
- ``arrows``: `.PatchCollection` containing `.FancyArrowPatch`
85-
objects representing the arrows half-way along stream lines.
86-
87-
This container will probably change in the future to allow changes
88-
to the colormap, alpha, etc. for both lines and arrows, but these
89-
changes should be backward compatible.
80+
`~.StreamplotContainer`
9081
"""
9182
grid=Grid(x,y)
9283
mask=StreamMask(density)
@@ -237,20 +228,50 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
237228
axes.add_patch(p)
238229

239230
axes.autoscale_view()
240-
stream_container=StreamplotSet(lc,ac)
231+
stream_container=StreamplotContainer((lc,ac))
241232
returnstream_container
242233

243234

235+
@_api.deprecated("major.minor",alternative="streamplot.StreamplotContainer")
244236
classStreamplotSet:
245-
246237
def__init__(self,lines,arrows):
247238
self.lines=lines
248239
self.arrows=arrows
249240

250241

242+
classStreamplotContainer(Container):
243+
"""
244+
`~.Container` object for artists created in an `~.Axes.streamplot` plot.
245+
246+
It can be treated like a namedtuple with fields ``(lines, arrows)``
247+
248+
.. versionadded major.minor ::
249+
250+
Attributes
251+
----------
252+
lines_arrows : tuple
253+
Tuple of (lines, arrows)
254+
``lines``: `.LineCollection` of the streamlines.
255+
``arrows``: `.PatchCollection` of the `.FancyArrowPatch` arrows
256+
half-way along each streamlines.
257+
258+
.. note::
259+
This container will probably change in the future to allow changes
260+
to the colormap, alpha, etc. for both lines and arrows, but these
261+
changes should be backward compatible.
262+
"""
263+
264+
def__init__(self,lines_arrows,**kwargs):
265+
lines,arrows=lines_arrows
266+
self.lines=lines
267+
self.arrows=arrows
268+
super().__init__(lines_arrows,**kwargs)
269+
270+
251271
# Coordinate definitions
252272
# ========================
253273

274+
254275
classDomainMap:
255276
"""
256277
Map representing different coordinate systems.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp