Re: Problem with PlotLegend in Mathematica 6.0

*To*: mathgroup at smc.vnet.net*Subject*: [mg78039] Re: Problem with PlotLegend in Mathematica 6.0*From*: Peter Breitfeld <phbrf at t-online.de>*Date*: Thu, 21 Jun 2007 06:01:00 -0400 (EDT)*References*: <f5atgq$apg$1@smc.vnet.net>

peter.steneteg at gmail.com schrieb: > 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? > > You should use Evaluate[fn] in the first case. Because Plot has the attribute HoldAll, PlotLegend otherwise can't see that fn is a list. Gruss Peter -- ==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-==-== Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de