Interactive Recomputation

The widgets work with the interact API, so that a cell can be recomputed as the widgets change value. This API is slated for improvement see #5867.

In [ ]:
import static com.twosigma.beakerx.groovy.widgets.Interactive.interact

class DataHolder{
    static Plot plot = null;

public static Object f(a,b){
    if (DataHolder.plot == null){
        DataHolder.plot = new Plot(title: "Lissajous Curves")

    List t = (1..1000)
    List x = t.collect { it -> sin(it*a/100)}
    List y = t.collect { it -> cos(it*b/100)}
    DataHolder.plot.add(new Line(x: x, y: y))
    return DataHolder.plot 

interact(this.&f, 3d, -3d);