finalize plotting routine