Re: Problem with PlotLegend in Mathematica 6.0

• To: mathgroup at smc.vnet.net
• Subject: [mg77995] Re: Problem with PlotLegend in Mathematica 6.0
• From: dh <dh at metrohm.ch>
• Date: Thu, 21 Jun 2007 05:38:17 -0400 (EDT)
• References: <f5atgq\$apg\$1@smc.vnet.net>

```
Ho peter,

Your first example will not work on any mathematica version prior to 6.

The reason is that Plot has the attribute HoldAll. Therefore what is fed

to Plot is: fn. This will not evaluate on prior versions because the

localized x from Plot and the global x from fn are different variables

and Plot will complain. There seems to have been a (may be dangerous

because of lozalitation) change in the implementation of Plot, but there

seems stiil to exist some hickups. A way out is to overwrite the HoldAll

by: Plot[Evaulate[fn],...]

hope this helps, Daniel

peter.steneteg at gmail.com wrote:

> I can not figure out why I get different results for these two cases.

>

> Needs["PlotLegends`"]

> fn = {Sin[x], Cos[x]}

> Plot[fn, {x, 0, 2 Pi}, PlotLegend -> {"sin", "cos"}]

> Plot[{Sin[x], Cos[x]}, {x, 0, 2 Pi}, PlotLegend -> {"sin", "cos"}]

>

> When i use Plot[fn,... the Legend will only show one line, "sin" but

> if I use the later case with Plot[{Sin[x],Cos[x]},... the Legend will

> show correctly. Does anyone have any idea why this happens. And if

> there are any solution?

>

>

```

• Prev by Date: RE: Button on a palette to create new text cells
• Next by Date: Re: Mathematica 6.0 dynamic display of lists of complex numbers.
• Previous by thread: Re: Problem with PlotLegend in Mathematica 6.0
• Next by thread: Re: Problem with PlotLegend in Mathematica 6.0