Re: listplot and legend (again)

• To: mathgroup at smc.vnet.net
• Subject: [mg80862] Re: listplot and legend (again)
• From: John Jowett <John.M.Jowett at gmail.com>
• Date: Tue, 4 Sep 2007 03:50:25 -0400 (EDT)
• References: <200708090918.FAA21022@smc.vnet.net>

I apologise for an error in my last post.  The definition of style12
should have been either

style12 = {
{Directive[{Red, Thick}], "Sin[x]"},
{Directive[{Blue, Thick}], "x^Sin[x]"}
};

in which case the rest of the example works (but the legend may not be
quite what one wants ... ) or

style12 = {
{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]"}
};

in which case the plot should be made with

plot12 = ListLinePlot[{data1, data2}, PlotStyle -> style12[[All, 1,
1]] ]

John Jowett

On Aug 22, 10:48 am, "Muench, Thomas" <thomas.mue... at fmi.ch> wrote:
> Hello, Arek
>
> When Mathematica automatically chooses colors for plotting inListPLot
> 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 thelegendas part of the
> Plot itself (as Epilog), the second shows thelegendas 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
>
>
> Hi,
>
> I know that there has been at least one post on this topic but I still
> can't drawlegendinsideListPlot.
>
> When i plot several curves, colors for them  are chosen automaticaly
> by Mathematica. How can I plot alegendfor them?
>
> May I ask for an example, please? Why quite good solution existed in
> MultipleListPlot in Mathv5.2 just vanished????
>
> Arek

• Prev by Date: Re: Interpretation of PrecisionGoal and AccuracyGoal
• Next by Date: Re: Re: Re: Rule-based programming: declare variables to be a number
• Previous by thread: Re: listplot and legend (again)
• Next by thread: Re: Interpretation of PrecisionGoal and AccuracyGoal