go(plot): use consts for common strings
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
2284f35e6d
commit
8b4432ece1
39
algo/plot.go
39
algo/plot.go
@ -19,27 +19,32 @@ import (
|
||||
"gonum.org/v1/plot/vg"
|
||||
)
|
||||
|
||||
const preferredFontStyle = "Mono"
|
||||
const (
|
||||
preferredFont = "Mono"
|
||||
titlePreferredFont = "Sans"
|
||||
yAxisLabel = "CF value"
|
||||
xAxisLabel = "Generations"
|
||||
)
|
||||
|
||||
func plotMeanVals(meanVals []float64, title string, fes int) *plot.Plot {
|
||||
plotter.DefaultFont.Typeface = preferredFontStyle
|
||||
plotter.DefaultFont.Typeface = preferredFont
|
||||
plotter.DefaultLineStyle.Width = vg.Points(2.0)
|
||||
|
||||
p := plot.New()
|
||||
|
||||
p.Title.Text = "Mean - " + title
|
||||
|
||||
p.X.Label.Text = "Generations"
|
||||
p.X.Label.TextStyle.Font.Variant = preferredFontStyle
|
||||
p.X.Label.Text = xAxisLabel
|
||||
p.X.Label.TextStyle.Font.Variant = preferredFont
|
||||
p.X.Label.TextStyle.Font.Weight = 1 // Medium
|
||||
p.X.Tick.Label.Font.Variant = preferredFontStyle
|
||||
p.Y.Label.Text = "CF value"
|
||||
p.Y.Label.TextStyle.Font.Variant = preferredFontStyle
|
||||
p.X.Tick.Label.Font.Variant = preferredFont
|
||||
p.Y.Label.Text = yAxisLabel
|
||||
p.Y.Label.TextStyle.Font.Variant = preferredFont
|
||||
p.Y.Label.TextStyle.Font.Weight = 1 // Medium
|
||||
p.Y.Tick.Label.Font.Variant = preferredFontStyle
|
||||
p.Y.Tick.Label.Font.Variant = preferredFont
|
||||
|
||||
p.Title.TextStyle.Font.Size = 14.5
|
||||
p.Title.TextStyle.Font.Variant = "Sans"
|
||||
p.Title.TextStyle.Font.Variant = titlePreferredFont
|
||||
p.Title.TextStyle.Font.Weight = 2 // SemiBold
|
||||
p.Title.Padding = 3 * vg.Millimeter
|
||||
|
||||
@ -96,7 +101,7 @@ func plotAllDims(algoStats []stats.Stats, fPrefix, fExt string, ch chan report.P
|
||||
pWidth := 13 * vg.Centimeter
|
||||
pHeight := 13 * vg.Centimeter
|
||||
|
||||
plotter.DefaultFont.Typeface = preferredFontStyle
|
||||
plotter.DefaultFont.Typeface = preferredFont
|
||||
plotter.DefaultLineStyle.Width = vg.Points(1.5)
|
||||
|
||||
for _, s := range algoStats {
|
||||
@ -116,17 +121,17 @@ func plotAllDims(algoStats []stats.Stats, fPrefix, fExt string, ch chan report.P
|
||||
pL.Bench = s.BenchFuncStats[0].BenchName
|
||||
pLMean.Bench = s.BenchFuncStats[0].BenchName
|
||||
|
||||
p.X.Label.Text = "Generations"
|
||||
p.X.Label.TextStyle.Font.Variant = preferredFontStyle
|
||||
p.X.Label.Text = xAxisLabel
|
||||
p.X.Label.TextStyle.Font.Variant = preferredFont
|
||||
p.X.Label.TextStyle.Font.Weight = 1 // Medium
|
||||
p.X.Tick.Label.Font.Variant = preferredFontStyle
|
||||
p.Y.Label.Text = "CF value"
|
||||
p.Y.Label.TextStyle.Font.Variant = preferredFontStyle
|
||||
p.X.Tick.Label.Font.Variant = preferredFont
|
||||
p.Y.Label.Text = yAxisLabel
|
||||
p.Y.Label.TextStyle.Font.Variant = preferredFont
|
||||
p.Y.Label.TextStyle.Font.Weight = 1 // Medium
|
||||
p.Y.Tick.Label.Font.Variant = preferredFontStyle
|
||||
p.Y.Tick.Label.Font.Variant = preferredFont
|
||||
|
||||
p.Title.TextStyle.Font.Size = 14.5
|
||||
p.Title.TextStyle.Font.Variant = "Sans"
|
||||
p.Title.TextStyle.Font.Variant = titlePreferredFont
|
||||
p.Title.TextStyle.Font.Weight = 2 // SemiBold
|
||||
p.Title.Padding = 3 * vg.Millimeter
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user