I have a list of lists looking like this: {{{x1, y1}, {x2, y2}}, {x1, y1},...}}. Furthermore I have defined a legend, which is taken from the filenames.
Now I want to plot this data dynamically, add/remove sub-lists in a ListLinePlot, e.g. with a Checkbox. This is the part of the code I have so far:
Importing the data:
files = FileNames["*.dat"];
data = Import[#, "Data"] & /@ files;
legend = StringReplace[files, ".dat" -> ""];
So far I have made the plot like this:
plot1 = ListLinePlot[data[[1]], PlotLegends -> legend[[1]]];
plot2 = ListLinePlot[data[[2]], PlotLegends -> legend[[2]]];
Manipulate[
Show[
If[x1 == True, plot1, Sequence @@ {}],
If[x2 == True, plot2, Sequence @@ {}],
{{x1, True, "plot1"}, {True, False}}, {{x2, True, "plot2"}]
Is there maybe a more elegent way of realizing this, maybe automatically, for list of sub-lists?

