func (SquareGlyph) DrawGlyph(c *Canvas, sty GlyphStyle, pt vg.Point) {
	c.SetLineStyle(LineStyle{Color: sty.Color, Width: vg.Points(0.5)})
	x := (sty.Radius-sty.Radius*cosπover4)/2 + sty.Radius*cosπover4
	p := make(vg.Path, 0, 5)
	p.Move(vg.Point{X: pt.X - x, Y: pt.Y - x})
	p.Line(vg.Point{X: pt.X + x, Y: pt.Y - x})
	p.Line(vg.Point{X: pt.X + x, Y: pt.Y + x})
	p.Line(vg.Point{X: pt.X - x, Y: pt.Y + x})
	p.Close()
	c.Stroke(p)
}
DrawGlyph implements the Glyph interface.
package draw  
import (
	"fmt"
	"image/color"
	"math"
	"sort"
	"sync"
	"gonum.org/v1/plot/text"
	"gonum.org/v1/plot/vg"
)
var formats = struct {
	sync.RWMutex
	m map[string]func(w, h vg.Length) vg.CanvasWriterTo
}{
	m: make(map[string]func(w, h vg.Length) vg.CanvasWriterTo),
}
func Formats() []string {
	formats.RLock()
	defer formats.RUnlock()
	list := make([]string, 0, len(formats.m))
	for name := range formats.m {
		list = append(list, name)
	}
	sort.Strings(list)
	return list
}
func RegisterFormat(name string, fn func(w, h vg.Length) vg.CanvasWriterTo) {
	formats.Lock()
	defer formats.Unlock()
	if fn == nil {
		panic("draw: RegisterFormat with nil function")
	}
	formats.m[name] = fn
}
type Canvas struct {
	vg.Canvas
	vg.Rectangle
}
type XAlignment = text.XAlignment
const (
	XLeft = text.XLeft
	XCenter = text.XCenter
	XRight = text.XRight
)
type YAlignment = text.YAlignment
const (
	YTop = text.YTop
	YCenter = text.YCenter
	YBottom = text.YBottom
)
const (
	PosLeft   = text.PosLeft
	PosBottom = text.PosBottom
	PosCenter = text.PosCenter
	PosTop    = text.PosTop
	PosRight  = text.PosRight
)
type LineStyle struct {
	Color color.Color
	Width vg.Length
	Dashes   []vg.Length
	DashOffs vg.Length
}
type GlyphStyle struct {
	color.Color
	Radius vg.Length
	Shape GlyphDrawer
}
type GlyphDrawer interface {
	DrawGlyph(*Canvas, GlyphStyle, vg.Point)
}
func (c *Canvas) DrawGlyph(sty GlyphStyle, pt vg.Point) {
	if sty.Shape == nil || !c.Contains(pt) {
		return
	}
	c.SetColor(sty.Color)
	sty.Shape.DrawGlyph(c, sty, pt)
}
func (c *Canvas) DrawGlyphNoClip(sty GlyphStyle, pt vg.Point) {
	if sty.Shape == nil {
		return
	}
	c.SetColor(sty.Color)
	sty.Shape.DrawGlyph(c, sty, pt)
}
func (g GlyphStyle) Rectangle() vg.Rectangle {
	return vg.Rectangle{
		Min: vg.Point{X: -g.Radius, Y: -g.Radius},
		Max: vg.Point{X: +g.Radius, Y: +g.Radius},
	}
}
type CircleGlyph struct{}
func (CircleGlyph) DrawGlyph(c *Canvas, sty GlyphStyle, pt vg.Point) {
	p := make(vg.Path, 0, 3)
	p.Move(vg.Point{X: pt.X + sty.Radius, Y: pt.Y})
	p.Arc(pt, sty.Radius, 0, 2*math.Pi)
	p.Close()
	c.Fill(p)
}
type RingGlyph struct{}
func (RingGlyph) DrawGlyph(c *Canvas, sty GlyphStyle, pt vg.Point) {
	c.SetLineStyle(LineStyle{Color: sty.Color, Width: vg.Points(0.5)})
	p := make(vg.Path, 0, 3)
	p.Move(vg.Point{X: pt.X + sty.Radius, Y: pt.Y})
	p.Arc(pt, sty.Radius, 0, 2*math.Pi)
	p.Close()
	c.Stroke(p)
}
const (
	cosπover4 = vg.Length(.707106781202420)
	sinπover6 = vg.Length(.500000000025921)
	cosπover6 = vg.Length(.866025403769473)
)
type SquareGlyph struct{}