Rewriting the plot-subroutine for doing only one plot