plot script modified