Corrects issue with running as source

Function call would not plot the graphs, now it does