adding callback for plots