# How to show legend in a combined plot of many lists,

I am having trouble with adding a legend to a plot. The example I discuss here is simpler than my real problem, but describes it well.

I have a vector, called X with dimensions (100 x 6). I use the command ListPlot to plot one row of X at a time:

plotX={};
Do[
p1=ListPlot[X[[i]]];
AppendTo[plotX,p1],
{i,1,Length[X]}];


Therefore, the list plotX contains six list plots with 100 points each. To show all the plots, I use the command Show

Show[plotX]


Now I want to create a legend for this graph, for example {"x1","x2","x3","x4","x5","x6"}. How can I do this?

Thanks

-
If you have version 9 you can use the PlotLegends option. –  b.gatessucks Dec 12 '12 at 16:59
@b.gatessucks - Unfortunately I have version 7, however PlotLegends work in version 7 too, in fact sometimes I used it, but in this case I can't to resolve the problem with that command –  Emanuele Dec 12 '12 at 17:06
It would help if you add to the question information about what happens when you try to use PlotLegends in your version. –  David Z Dec 12 '12 at 17:14
@DavidZaslavsky - Simple problem like: Plot[{Sin[x], Cos[x]}, {x, 0, 2 Pi}, PlotLegend -> {"sine", "cosine"}] I have no problem, but in my example gives me error and a message: An unr"ecognized option name ("PlotLegendsPlotLegend") was encountered while reading a GraphicsBox." –  Emanuele Dec 12 '12 at 17:35
@Emanuele as I said, it helps if you add the information to the question, that way it is properly visible. –  David Z Dec 12 '12 at 17:45

I would plot all the data sets you have in one go :

\$Version
(* "7.0 for Linux x86 (64-bit) (February 18, 2009)" *)

data = Table[Sin[i] + j, {i, 1, 100}, {j, 1, 6}];

Needs["PlotLegends"]

ListPlot[Transpose[data], Joined -> True,
PlotLegend -> {"x1", "x2", "x3", "x4", "x5", "x6"}]


-
I have to plot a list of point not a function therefore I can't do the graph in this way. –  Emanuele Dec 12 '12 at 19:12
I am not plotting a function, I used Sin just to make up some data. Have a look at my data or post yours and I'll update my answer. –  b.gatessucks Dec 12 '12 at 19:22