# to see contents of create_data function, look at the second-to-top-most algorithm's code
figure, axes, handles = create_plots(data, baselines)
for i, (ax, y) in enumerate(zip(axes, data)):
    if i == 1:
        half_window = 50
    else:
        half_window = 20
    baseline, params = baseline_fitter.jbcd(
        y, half_window, gamma=1, beta_mult=1.05, gamma_mult=0.95
    )

    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 jcbd'), loc='center', frameon=False
)