update the code for plots