listplot and legend (again)
- To: mathgroup at smc.vnet.net
- Subject: [mg80424] listplot and legend (again)
- From: "Muench, Thomas" <thomas.muench at fmi.ch>
- Date: Wed, 22 Aug 2007 04:42:50 -0400 (EDT)
- References: <200708090918.FAA21022@smc.vnet.net> <200708141102.HAA09457@smc.vnet.net> <46C1B0C1.4000908@tue.nl>
Hello, Arek When Mathematica automatically chooses colors for plotting in ListPLot or ListLinePlot, it takes colors defined in ColorData[1], in the order defined there. That means, your first line (or set of points) is plotted in ColorData[1,1], the second in ColorData[1,2], and so on. I don't think that this is mentioned anywhere in the Help system. Once you know this, it is straight foreward to make your own legends, with not need for the PlotLegend package. Here are two examples; the first one plots the legend as part of the Plot itself (as Epilog), the second shows the legend as a separate element next to the Plot. data = Table[RandomReal[], {4}, {5}]; legend = Framed@ Column[Table[ Style["data " <> ToString[i], ColorData[1, i], Bold, "Graphics", 15], {i, Length[data]}]]; (* Example 1 *) ListLinePlot[data, ImageSize -> 300, Epilog -> Inset[legend, {.5, .5}]] (* Example 2 *) Row[{ListLinePlot[data, ImageSize -> 300], legend}] Hope that helps, Thomas On 8/14/07, Arkadiusz.Ma... at gmail.com <Arkadiusz.Ma... at gmail.com> wrote: Hi, I know that there has been at least one post on this topic but I still can't draw legend inside ListPlot. When i plot several curves, colors for them are chosen automaticaly by Mathematica. How can I plot a legend for them? May I ask for an example, please? Why quite good solution existed in MultipleListPlot in Mathv5.2 just vanished???? Arek
- References:
- Version 6 "Mathematica Book" - updated and expanded
- From: thomas <thomas.muench@gmail.com>
- Re: Version 6 "Mathematica Book" - updated
- From: thomas <thomas.muench@gmail.com>
- Version 6 "Mathematica Book" - updated and expanded