I have multiple curves in my plot, and want to be able to toggle their visibility off/on. Which I got to work thanks to a different post.
data = {{1, 2, 3}, {2, 5}, {0, 6}};
Manipulate[ListPlot[data,
Joined -> True, PlotRange -> {-1, 5},
PlotStyle -> {Opacity[a], Opacity[b], Opacity[c]}],
{{a, 1, "f1"}, {1, 0}}, {{b, 1, "f2"}, {1, 0}}, {{c, 1, "f3"}, {1, 0}}]
My dataset is not always of the same dimensions though. So depending on the data loaded I might have only two graphs next time I run my notebook.
data= {{1, 3}, {0, 2}}
Is there a nice way to make my code automatically adjust to the number of graphs?
I think i could make this work using Table
and Length[data]
, but it feels as if there is a simpler and nicer way.
I'd appreciate any help!
Length[data]
,so you'll need to use it either explicitly or implicitly $\endgroup$