Re: DisplayTogether & PlotLegend incompatibility
- To: mathgroup at smc.vnet.net
- Subject: [mg70828] Re: [mg70815] DisplayTogether & PlotLegend incompatibility
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 28 Oct 2006 23:38:01 -0400 (EDT)
- Reply-to: hanlonr at cox.net
Needs["Graphics`"]; mlpData={ {{1,0},{2,1},{3,2}}, {{1,1},{2,2},{3,3}}, {{1,2},{2,3},{3,4}}}; pts={{1.5,2.5},{2,2},{2.5,1.5}}; Module[{n, len=Length[mlpData]}, MultipleListPlot[Sequence@@mlpData, PlotStyle->Table[Hue[n/len,1,0.8],{n,len}], PlotJoined->True, AxesLabel->{"Displacement,\nmm","Force, N"}, SymbolShape->None, PlotLegend->{"one","two","three"}, LegendSize->.36, LegendPosition->{.63,-0.18}, ImageSize->500, Epilog->{AbsolutePointSize[5], Point/@pts}]]; You could use a Frame Module[{n, len=Length[mlpData]}, MultipleListPlot[Sequence@@mlpData, Frame->True, PlotStyle->Table[Hue[n/len,1,0.8],{n,len}], PlotJoined->True, FrameLabel->{"\nDisplacement, mm","Force, N\n"}, SymbolShape->None, PlotLegend->{"one","two","three"}, LegendSize->.36, LegendPosition->{.58,-0.42}, ImageSize->500, Epilog->{AbsolutePointSize[5], Point/@pts}]]; Bob Hanlon ---- Will Robertson <wspr81 at gmail.com> wrote: > Hello, > > Having been used to plotting graphs in another system, I find myself out of my > depth in Mathematica :) > > In the attached code, I use the MultipleListPlot & Legend packages to > try and plot a set of curves with some overlayed points using > DisplayTogether. This works well until I try and add a legend (with > PlotLegend) as you can see. The second set of data is scaled way out of > proportion. Is this a misconception on my part? > > (I don't really want to do everything in a single MultipleListPlot > because I algorithmically assign colours to the first set of graphs > with something like > manyHues[steps_] := Table[{Hue[i/steps, 1, 0.8]}, {i, 1, steps, 1}] > Maybe there's a better way to do this...) > > Any help would be greatly appreciated. > Many thanks! > > Will Robertson > Adelaide, Australia > > > <<Graphics`MultipleListPlot` > <<Graphics`Legend` > > DisplayTogether[ > MultipleListPlot[ > {{1,0},{2,1},{3,2}}, > {{1,1},{2,2},{3,3}}, > {{1,2},{2,3},{3,4}}, > {PlotJoined\[Rule]True, > AxesLabel\[Rule]{"Displacement, mm","Force, N"}, > SymbolShape\[Rule] None}], > MultipleListPlot[ > {{1.5,2.5},{2,2},{2.5,1.5}}, > {PlotJoined\[Rule]False}]] > > DisplayTogether[ > MultipleListPlot[ > {{1,0},{2,1},{3,2}}, > {{1,1},{2,2},{3,3}}, > {{1,2},{2,3},{3,4}}, > {PlotJoined\[Rule]True, > AxesLabel\[Rule]{"Displacement, mm","Force, N"}, > SymbolShape\[Rule] None, > PlotLegend\[Rule]{"one","two","three"}}], > MultipleListPlot[ > {{1,3},{2,2},{3,1}}, > {PlotJoined\[Rule]False}]] >