re-write MI plot script