Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here's a slightly different (banana-themed) workaround. Run the following before making the plot:

# monkeypatch legend duplication of trac #11225
def fix_piecewise(fn):
    import types
    def fixed_plot(self, *args, **kwargs): 
        from sage.plot.all import plot
        return sum([plot(f, a, b, *args, **(dict((k,v) for k,v in kwargs.items() if i == 0 or k != 'legend_label')))
                    for i, ((a,b),f) in enumerate(self.list())])
    def fn2(*args, **kwargs):
        ans = fn(*args, **kwargs)
        ans.plot = types.MethodType(fixed_plot, ans)
        return ans
    return fn2

Piecewise = fix_piecewise(Piecewise)

after which it should behave.