func savePlot(title, directory string, plot *plot.Plot) { _, err := os.Stat(directory) if os.IsNotExist(err) { os.MkdirAll(directory, 0755) } plotFilename := strings.Replace(directory+"/"+title+".eps", " ", "", -1) err = plot.Save(4, 4, plotFilename) if err != nil { panic(err) } }