Updating plotting function