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

Commit833d45a

Browse files
committed
Changed streamplot return type: StreamplotSet->StreamplotContainer
Deprecated StreamplotSetAdded StreamplotContainer
1 parentf975291 commit833d45a

File tree

1 file changed

+42
-12
lines changed

1 file changed

+42
-12
lines changed

‎lib/matplotlib/streamplot.py

Lines changed: 42 additions & 12 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,9 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
7677
7778
Returns
7879
-------
79-
StreamplotSet
80-
Container object with attributes
80+
`~.StreamplotContainer`
8181
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.
82+
.. versionchanged major.minor::
9083
"""
9184
grid=Grid(x,y)
9285
mask=StreamMask(density)
@@ -237,20 +230,57 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
237230
axes.add_patch(p)
238231

239232
axes.autoscale_view()
240-
stream_container=StreamplotSet(lc,ac)
233+
stream_container=StreamplotContainer((lc,ac))
241234
returnstream_container
242235

243236

237+
@_api.deprecated("major.minor",alternative="streamplot.StreamplotContainer")
244238
classStreamplotSet:
245-
246239
def__init__(self,lines,arrows):
247240
self.lines=lines
248241
self.arrows=arrows
249242

250243

244+
classStreamplotContainer(Container):
245+
"""
246+
`~.Container` object for artists created in an `~.Axes.streamplot` plot.
247+
248+
It can be treated like a namedtuple with fields ``(lines, arrows)``
249+
250+
.. versionadded major.minor ::
251+
252+
Attributes
253+
----------
254+
lines: `~.LineCollection`
255+
` The collection of `.Line2d` segments that make up the streamlines
256+
arrows: `~.PatchCollection`
257+
The collection of `.FancyArrow` arrows half-way along each streamline
258+
259+
.. note::
260+
This container will probably change in the future to allow changes
261+
to the colormap, alpha, etc. for both lines and arrows, but these
262+
changes should be backward compatible.
263+
"""
264+
265+
def__init__(self,lines_arrows,**kwargs):
266+
"""
267+
Parameters
268+
----------
269+
lines_arrows : tuple
270+
Tuple of (lines, arrows)
271+
``lines``: `.LineCollection` of streamlines.
272+
``arrows``: `.PatchCollection` of `.FancyArrowPatch` arrows
273+
"""
274+
lines,arrows=lines_arrows
275+
self.lines=lines
276+
self.arrows=arrows
277+
super().__init__(lines_arrows,**kwargs)
278+
279+
251280
# Coordinate definitions
252281
# ========================
253282

283+
254284
classDomainMap:
255285
"""
256286
Map representing different coordinate systems.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp