diff --git a/algo/plot.go b/algo/plot.go index 5ed19d9..bfbb226 100644 --- a/algo/plot.go +++ b/algo/plot.go @@ -103,9 +103,11 @@ func plotAllDims(algoStats []stats.Stats, fPrefix, fExt string, ch chan report.P p := plot.New() pic := report.NewPic() - p.Title.Text = "D: " + fmt.Sprint(s.Dimens) + - ", G: " + fmt.Sprint(s.Generations) + - ", I: " + fmt.Sprint(s.Iterations) + p.Title.Text = fmt.Sprintf("D: %d, G: %d, I: %d", + s.Dimens, + s.Generations, + s.Iterations, + ) // this is latex-rendered. pic.Caption = strings.ReplaceAll(p.Title.Text, " ", "~") @@ -165,19 +167,24 @@ func plotAllDims(algoStats []stats.Stats, fPrefix, fExt string, ch chan report.P log.Panic(err) } - filename := picsDir + - fPrefix + "-" + - util.SanitiseFName(s.Algo) + "-" + - util.SanitiseFName(dim.BenchName) + "-" + - fmt.Sprint(s.Dimens) + "D-" + - fmt.Sprint(s.Generations) + "G-" + - fmt.Sprint(len(dim.BenchResults)) + "I" + filename := fmt.Sprintf("%s%s-%s-%s-%dD-%dG-%dI", + picsDir, + fPrefix, + util.SanitiseFName(s.Algo), + util.SanitiseFName(dim.BenchName), + s.Dimens, + s.Generations, + len(dim.BenchResults), + ) filenameMean := filename + util.SanitiseFName(" Mean") // NEVER EVER ATTEMPT TO INITIALISE THIS WITH `pic`! picMean := report.NewPic() - meanTitle := "D: " + fmt.Sprint(s.Dimens) + ", G: " + - fmt.Sprint(s.Generations) + ", I: " + fmt.Sprint(s.Iterations) + meanTitle := fmt.Sprintf("D: %d, G: %d, I: %d", + s.Dimens, + s.Generations, + s.Iterations, + ) // this is latex-rendered. picMean.Caption = "Mean - " + strings.ReplaceAll(meanTitle, " ", "~") @@ -190,8 +197,9 @@ func plotAllDims(algoStats []stats.Stats, fPrefix, fExt string, ch chan report.P pMean := plotMeanVals(dim.MeanVals, meanTitle, s.Generations) elapsed := time.Since(start) - info := "saving img to file: " + filename + "(-Mean)" + fExt + - " [generated in " + fmt.Sprint(elapsed) + "]" + info := fmt.Sprintf("saving img to file: %s(-Mean)%s [generated in %s]", + filename, fExt, elapsed, + ) if s.Algo == "Random Search" { printRandomSearch(info)