Extract plot function
Finished