Cleaned up code for derivative example
Corrected tmp path in plot script