1 | initial version |

This is a bug, I think. Here is the documentation for `Piecewise`

plotting.

```
def plot(self, *args, **kwds):
"""
Returns the plot of self.
Keyword arguments are passed onto the plot command for each piece
of the function. E.g., the plot_points keyword affects each
segment of the plot.
```

So that includes the legend ones, which however, is *not* what you want, as opposed to some of the other options. I've added this to the piecewise plotting bug ticket.

2 | No.2 Revision |

This is a bug, I think. Here is the documentation for `Piecewise`

plotting.

```
def plot(self, *args, **kwds):
"""
Returns the plot of self.
Keyword arguments are passed onto the plot command for each piece
of the function. E.g., the plot_points keyword affects each
segment of the plot.
```

So that includes the legend ones, which however, is *not* what you want, as opposed to some of the other options. I've added this to the piecewise plotting bug ticket.

Update: Here is a workaround of sorts. Unfortunately, it means plotting each part separately, only labeling one of them.

```
sage: P = plot(Piecewise([[(0,1),x]]),legend_label='f(x)')
sage: Q = plot(Piecewise([[(1,2),x^2]]),legend_label='')
sage: R = plot(Piecewise([[(0,1),x^2]]),legend_label='g(x)',color='red')
sage: S = plot(Piecewise([[(1,2),x]]),legend_label='',color='red')
sage: P+Q+R+S
```

Or you could just skip the `legend_label`

option totally on `Q`

and `S`

.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.