<commit_before>// The plt package implements low-level plotting functionality.
package plt

import (
	"image/color"
)

// A Plot is a pair of axes, an optional title and a set of
// data elements that can be drawn to a drawArea.
type Plot struct {
	Title      struct {
		Text string
		TextStyle
	}
	XAxis      horizontalAxis
	YAxis      verticalAxis
}

// NewPlot returns a new plot.
func NewPlot() *Plot {
	titleFont, err := MakeFont("Times-Roman", 12)
	if err != nil {
		panic(err)
	}
	p := &Plot{
		XAxis: horizontalAxis{makeAxis()},
		YAxis: verticalAxis{makeAxis()},
	}
	p.Title.TextStyle = TextStyle{
		Color: color.RGBA{A: 255},
		Font:  titleFont,
	}
	return p
}

// draw draws a plot to a drawArea.
func (p *Plot) draw(da *drawArea) {
	da.SetColor(White)
	da.Fill(rectPath(da.rect))
	da.SetColor(Black)
	da.Stroke(rectPath(da.rect))

	if p.Title.Text != "" {
		da.setTextStyle(p.Title.TextStyle)
		fillText(da, da.center().x, da.max().y, -0.5, -1, p.Title.Text)
		da.size.y -= textHeight(p.Title.Font, p.Title.Text)
	}

	ywidth := p.YAxis.size()
	p.XAxis.draw(da.crop(ywidth, 0, 0, 0).squishX(p.XAxis.glyphBoxes()))

	xheight := p.XAxis.size()
	p.YAxis.draw(da.crop(0, xheight, 0, 0).squishY(p.YAxis.glyphBoxes()))
}<commit_msg>Change the Plot's XAxis and YAxis fields to be of type Axis. This way, they show up better in go doc.<commit_after>// The plt package implements low-level plotting functionality.
package plt

import (
	"image/color"
)

// A Plot is a pair of axes, an optional title and a set of
// data elements that can be drawn to a drawArea.
type Plot struct {
	Title      struct {
		Text string
		TextStyle
	}
	XAxis, YAxis Axis
}

// NewPlot returns a new plot.
func NewPlot() *Plot {
	titleFont, err := MakeFont("Times-Roman", 12)
	if err != nil {
		panic(err)
	}
	p := &Plot{
		XAxis: makeAxis(),
		YAxis: makeAxis(),
	}
	p.Title.TextStyle = TextStyle{
		Color: color.RGBA{A: 255},
		Font:  titleFont,
	}
	return p
}

// draw draws a plot to a drawArea.
func (p *Plot) draw(da *drawArea) {
	da.SetColor(White)
	da.Fill(rectPath(da.rect))
	da.SetColor(Black)
	da.Stroke(rectPath(da.rect))

	if p.Title.Text != "" {
		da.setTextStyle(p.Title.TextStyle)
		fillText(da, da.center().x, da.max().y, -0.5, -1, p.Title.Text)
		da.size.y -= textHeight(p.Title.Font, p.Title.Text)
	}

	x := horizontalAxis{p.XAxis}
	y := verticalAxis{p.YAxis}

	ywidth := y.size()
	x.draw(da.crop(ywidth, 0, 0, 0).squishX(x.glyphBoxes()))

	xheight := x.size()
	y.draw(da.crop(0, xheight, 0, 0).squishY(y.glyphBoxes()))
}
{'fraction_non_alphanumeric': 0.15582870737509913, 'fraction_numerical': 0.011102299762093577, 'mean_word_length': 3.4575971731448765, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5119235', 'n_tokens_mistral': 1060, 'n_tokens_neox': 990, 'n_words': 259}