"""
Area Scan with custom 1D plot
"""
set_preference(Preference.PLOT_TYPES, {'sin':1})



p = plot(None, title="1d")[0]
def AfterReadout(record, scan):
    if record.setpoints[1] == scan.getStart()[1]:
        p.addSeries(LinePlotSeries(str(record.positions[0])))
    p.getSeries(p.numberOfSeries-1).appendData(record.positions[1], record.values[0])    
        

ascan((dev,out), (sin,arr), (0,10), (20,30), (20,20), 0.2, after_read=AfterReadout)