Complete automation of obtaining plots

1. Finally plot automation cracked.
2. Convering script to function.
3. Plotting of first part of the function done.