I need to build an interactive interface to visualize multiples plots at the same time.
Let's consider two lists:
a ={{{5.34799, 0.0266045}, {10.696, 0.0335664}, {16.044,
0.0375446}, {21.392, 0.0411499}, {26.74, 0.0441336}, {37.4359,
0.0484848}, {48.1319, 0.0566899}, {58.8279, 0.086651}, {69.5239,
0.145206}}, {{4.64667, 0.0230256}, {9.29334, 0.0311688}, {13.94,
0.0404352}, {18.5867, 0.0520884}, {23.2333, 0.064584}, {32.5267,
0.0902772}, {41.82, 0.116813}, {51.1133, 0.149666}, {60.4067,
0.198526}}, {{5.94141, 0.0234662}, {11.8828, 0.0331042}, {17.8242,
0.0448373}, {23.7656, 0.0581069}, {29.707, 0.0723542}, {41.5899,
0.102944}, {53.4727, 0.137445}, {65.3555, 0.192479}, {77.2383,
0.268325}}};
b ={{{4.40558, 0.0167801}, {8.81116, 0.0228161}, {13.2167,
0.03018}, {17.6223, 0.0375439}, {22.0279, 0.0455114}, {30.8391,
0.0610843}, {39.6502, 0.0795545}, {48.4614, 0.102129}, {57.2725,
0.132913}}, {{5.3193, 0.0241877}, {10.6386, 0.0302957}, {15.9579,
0.0362815}, {21.2772, 0.0423895}, {26.5965, 0.048131}, {37.2351,
0.060347}, {47.8737, 0.0746398}, {58.5123, 0.0922308}, {69.1509,
0.134498}}, {{3.74719, 0.0189235}, {7.49439, 0.0256819}, {11.2416,
0.0318259}, {14.9888, 0.0377242}, {18.736, 0.043991}, {26.2304,
0.0557875}, {33.7247, 0.0686899}, {41.2191, 0.0818381}, {48.7135,
0.0980582}}};
Each sublist of a and b has a corresponding f list: a[1] --> fa1, a[2] --> fa2 etc..
Let's consider for instance the following f:
fa1 = Prime[Range[25]];
fa2 = Log[Range[10, 20]];
fa3 = Prime[Range[5]];
fb1 = Log[Range[5, 20]];
fb2 = Log[Range[30, 60]];
fb3 = Prime[Range[50]];
I want to plot a and b lists, click with my mouse each plotted curve and visualize the corresponding f plotted alongside.
I wrote the following code that I would like to improve.
status = 1;
uno = ListLinePlot[{Button[a[[1]], status = 1],
Button[a[[2]], status = 2], Button[a[[3]], status = 3],
Button[b[[1]], status = 4], Button[b[[2]], status = 5],
Button[b[[3]], status = 6]}, PlotStyle -> Automatic, PlotLegends -> Placed[{"curve"}, Below], AxesLabel -> {"x", "y"}];
f = {fa1, fa2, fa3, fb1, fb2, fb3};
due = Dynamic[Manipulate[ListLinePlot[f[[status]], PlotRange -> {{0, x}, {0, y}},PlotStyle -> Automatic, AxesLabel -> {"x", "y"},PlotLabel -> "Function"], {x, 10}, {y, 50}]];
TableForm[{{uno, due}}]
**In summary, I would like to:
1) click on a plot like this one:**
3) Highlight the curves that I click; 2) visualize all the f that I click, something like:
- Obtain an automatic code for hundreds of lists.
Thanks in advance!
Dynamic
wrapper around Manipulate. I can't see any reason why you would need it. Then, try replacing your manually created list inListLinePlot
, withMapIndexed[Button[#, status = First@#2] &, Join[a, b]]
. $\endgroup$