code and graphics for plots