Re: PlotLegend and ListPlot

*To*: mathgroup at smc.vnet.net*Subject*: [mg78277] Re: [mg78098] PlotLegend and ListPlot*From*: Gerry Flanagan <flanagan at materials-sciences.com>*Date*: Wed, 27 Jun 2007 05:32:48 -0400 (EDT)*References*: <200706231100.HAA10212@smc.vnet.net> <c2baae590706251911h2e540c97ra114feda218d3940@mail.gmail.com>

You're right - it would have just been so easy to make ListPlot have the PlotLegend option. The extra work is that now one has to define the series of PlotStyle's instead of use the convenient defaults. Thanks Gerry F. Stern wrote: > Maybe I'm missing the problem, but why not do it like this? > > In[1]:= Needs["PlotLegends`"] > > In[2]:= a = ListPlot[Table[{x, Sin[x]}, {x, 1, 5}], Mesh -> All, > Joined -> True, PlotStyle -> {Red}]; (* example list 1 *) > > In[3]:= b = ListPlot[Table[{x, x^Sin[x]}, {x, 1, 5}], Mesh -> All, > Joined -> True, PlotStyle -> {Blue}]; (* example list 2 *) > > In[4]:= l = {{Graphics[{Red, Thick, Line[{{0.05, .7}, {0.25, .7}}]}], > "Sin[x]"}, {Graphics[{Blue, Thick, > Line[{{0.05, .7}, {0.25, .7}}]}], "x^Sin[x]"}}; (* example legend *) > > In[5]:= ShowLegend[ > Show[a, b, PlotRange -> All], {legndB, LegendPosition -> {.2, .3}, > LegendSize -> {.62, .3}}] (* show them all together *) > > Normally, I would do this in a single line rather than five, but I've > broken it apart here for the sake of readability. > > Hope that helps. > > -stern > > > > > On 6/23/07, Gerry Flanagan <flanagan at materials-sciences.com> wrote: >> It appears that PlotLegend doesn't work with ListPlot. MultipleListPlot >> is now obsolete, so how do I put legends on list plots? Building my own >> equivalent to MultipleListPlot is going to be a pain. Seems like a >> simple thing that Wolfram just missed. >> Gerry Flanagan >> >> >

**References**:**PlotLegend and ListPlot***From:*Gerry Flanagan <flanagan@materials-sciences.com>