I would like to create a graph using ListPlot
which prints new dataset every time the button is evaluated (based on the value given in InputField
), by adding the new curve to the one that has been previously plotted, showing multiple curves.
For example: if the button is clicked 5 times, the graph should show 5 curves.
The ListPlot
I have here does replace the old dataset with the new one (always showing only one curve) every time the value of InputField
is changed and button is re-evaluated, which is not what I want. How to force ListPlot
to print the new curve while keeping the old one?
DynamicModule[{inputValue = 0, dataSet = {}},
Column[{
InputField[Dynamic[inputValue]],
Button["Plot", dataSet = Table[inputValue + i^j, {i, 5}, {j, 2}]],
Spacer[5],
Dynamic@ListPlot[dataSet, Joined -> True, ImageSize -> {300}]
}]]