From 9875323ed79767751f05a109e44c5da7556e6ce2 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Sun, 29 Apr 2012 11:46:30 -0400 Subject: [PATCH] Change return value of `streamplot`. - 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. --- lib/matplotlib/streamplot.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/matplotlib/streamplot.py b/lib/matplotlib/streamplot.py index ac29c3eff237..2edd56229ef0 100644 --- a/lib/matplotlib/streamplot.py +++ b/lib/matplotlib/streamplot.py @@ -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'] @@ -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 @@ -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