<commit_before>// Copyright 2015 <NAME> and <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package plt

import "github.com/cpmech/gosl/io"

// Formatter defines an interface to format lines with markers and colors
type Formatter interface {
	GetArgs(start string) string
}

// FmtS implemetns a formatter using a slice of strings
type FmtS []string

// ShapeData holds data for drawing shapes
type FmtH struct {
	Fc     string
	Ec     string
	Lw     int
	Closed bool
}

// LineData holds data for ploting lines
type FmtL struct {
	L  string
	C  string
	Lw float64
	Ms float64 // negative values => default
	M  string
	Ls string
}

// Init initialises ShapeData with default values
func (o *FmtH) Init() {
	o.Fc = "#edf5ff"
	o.Ec = "black"
	o.Lw = 1
}

// GetArgs returns the arguments for plt
func (o FmtS) GetArgs(start string) string {
	l := "'"
	for _, s := range o {
		l += s
	}
	return l + "'"
}

// GetArgs returns arguments for Plot
func (o FmtL) GetArgs(start string) string {
	l := start
	if o.L != "" {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("label='%s'", o.L)
	}
	if o.C != "" {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("color='%s'", o.C)
	}
	if o.Lw > 0 {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("lw=%g", o.Lw)
	}
	if o.Ms > 0 {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("ms=%d", int(o.Ms))
	}
	if o.M != "" {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("marker='%s'", o.M)
	}
	if o.Ls != "" {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("ls='%s'", o.Ls)
	}
	return l
}
<commit_msg>styles fixed: start was being ignored<commit_after>// Copyright 2015 <NAME> and <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package plt

import "github.com/cpmech/gosl/io"

// Formatter defines an interface to format lines with markers and colors
type Formatter interface {
	GetArgs(start string) string
}

// FmtS implemetns a formatter using a slice of strings
type FmtS []string

// ShapeData holds data for drawing shapes
type FmtH struct {
	Fc     string
	Ec     string
	Lw     int
	Closed bool
}

// LineData holds data for ploting lines
type FmtL struct {
	L  string
	C  string
	Lw float64
	Ms float64 // negative values => default
	M  string
	Ls string
}

// Init initialises ShapeData with default values
func (o *FmtH) Init() {
	o.Fc = "#edf5ff"
	o.Ec = "black"
	o.Lw = 1
}

// GetArgs returns the arguments for plt
func (o FmtS) GetArgs(start string) string {
	l := "'"
	for _, s := range o {
		l += s
	}
	if start != "" {
		return l + "'" + "," + start
	}
	return l + "'"
}

// GetArgs returns arguments for Plot
func (o FmtL) GetArgs(start string) string {
	l := start
	if o.L != "" {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("label='%s'", o.L)
	}
	if o.C != "" {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("color='%s'", o.C)
	}
	if o.Lw > 0 {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("lw=%g", o.Lw)
	}
	if o.Ms > 0 {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("ms=%d", int(o.Ms))
	}
	if o.M != "" {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("marker='%s'", o.M)
	}
	if o.Ls != "" {
		if len(l) > 0 {
			l += ","
		}
		l += io.Sf("ls='%s'", o.Ls)
	}
	return l
}

{'fraction_non_alphanumeric': 0.1689884918231375, 'fraction_numerical': 0.010902483343428226, 'mean_word_length': 2.4478079331941545, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2826695', 'n_tokens_mistral': 1463, 'n_tokens_neox': 1365, 'n_words': 430}