How to add dynamic PlotLegends
to the below code?
DynamicModule[{inputData = 0, dataSet = {}},
Column[{
InputField[Dynamic[inputData]],
Button["Plot",
AppendTo[dataSet, Table[inputData + i^j, {i, 5}, {j, 2}]]],
Spacer[5],
Dynamic@ListPlot[dataSet, Joined -> True, ImageSize -> {300}]
}]]
I would like to have a PlotLegends
which appears only when the Button
is pressed and ListPlot
prints the curve, otherwise it shouldn't be visible. Also every time the Button
is pressed ListPlot
appends the new curve to the old one, therefore the PlotLegends
should print the name for every printed curve, but one at the time. How to achieve that?
I spent hours on searching some guidance which could give me at least an idea of how to start, but all I found is for the static PlotLegends
. This is why I'm asking you for a help.