Skip to content

Commit

Permalink
Change return value of streamplot.
Browse files Browse the repository at this point in the history
- Return object that derives from `object` since deriving from `Container` was not beneficial.
- This return value is a stopgap; the final return value should allow users to set the colormap, alpha, etc. for both lines and arrows.
  • Loading branch information
tonysyu committed Sep 2, 2012
1 parent 57a7d3d commit 9875323
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions lib/matplotlib/streamplot.py
Expand Up @@ -8,7 +8,6 @@
import matplotlib.colors as mcolors
import matplotlib.collections as mcollections
import matplotlib.patches as patches
import matplotlib.container as container


__all__ = ['streamplot']
Expand Down Expand Up @@ -50,7 +49,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
Returns
-------
*stream_container* : StreamplotContainer
*stream_container* : StreamplotSet
Container object with attributes
lines : `matplotlib.collections.LineCollection` of streamlines
arrows : collection of `matplotlib.patches.FancyArrowPatch` objects
Expand Down Expand Up @@ -159,19 +158,15 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
axes.autoscale_view(tight=True)

ac = matplotlib.collections.PatchCollection(arrows)
stream_container = StreamplotContainer(lc, arrows=ac)
stream_container = StreamplotSet(lc, ac)
return stream_container


class StreamplotContainer(container.Container):
class StreamplotSet(object):

def __new__(cls, *kl, **kwargs):
return tuple.__new__(cls)

def __init__(self, lines, arrows=None, **kwargs):
def __init__(self, lines, arrows, **kwargs):
self.lines = lines
self.arrows = arrows
container.Container.__init__(self, lines, **kwargs)


# Coordinate definitions
Expand Down

0 comments on commit 9875323

Please sign in to comment.