added function to plot P_OUT