The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Inactive » comp.soft-sys.math.mathematica

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: PlotLegend and ListPlot
Replies: 4   Last Post: Jun 27, 2007 5:53 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 99
Registered: 9/8/06
Re: PlotLegend and ListPlot
Posted: Jun 26, 2007 4:38 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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.


On 6/23/07, Gerry Flanagan <> 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

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.