# to see contents of create_data function, look at the second-to-top-most algorithm's code
figure, axes, handles = create_plots(data, baselines)
fit_params = [(3, 3), (0.15, 8), (0.1, 6), (0.25, 8), (0.1, 0.6)]
for i, (ax, y) in enumerate(zip(axes, data)):
    if i == 0:
        freq_cutoff = 0.002
    else:
        freq_cutoff = 0.005
    lam_0, asymmetry = fit_params[i]
    baseline, params = baseline_fitter.beads(
        y, freq_cutoff=freq_cutoff, lam_0=lam_0, lam_1=0.05, lam_2=0.2, asymmetry=asymmetry
    )

    ax.clear()  # remove the old plots in the axis
    data_handle = ax.plot(y)
    signal_handle = ax.plot(params['signal'])

axes[-1].clear()  # remove the old legend
axes[-1].legend(
    (data_handle[0], signal_handle[0]),
    ('data', 'signal from beads'), loc='center', frameon=False
)