MCPcopy Index your code
hub / github.com/gonum/plot / Plot

Method Plot

plotter/histogram.go:84–107  ·  view source on GitHub ↗

Plot implements the Plotter interface, drawing a line that connects each point in the Line.

(c draw.Canvas, p *plot.Plot)

Source from the content-addressed store, hash-verified

82// Plot implements the Plotter interface, drawing a line
83// that connects each point in the Line.
84func (h *Histogram) Plot(c draw.Canvas, p *plot.Plot) {
85 trX, trY := p.Transforms(&c)
86
87 for _, bin := range h.Bins {
88 ymin := c.Min.Y
89 ymax := c.Min.Y
90 if bin.Weight != 0 {
91 ymax = trY(bin.Weight)
92 }
93 xmin := trX(bin.Min)
94 xmax := trX(bin.Max)
95 pts := []vg.Point{
96 {X: xmin, Y: ymin},
97 {X: xmax, Y: ymin},
98 {X: xmax, Y: ymax},
99 {X: xmin, Y: ymax},
100 }
101 if h.FillColor != nil {
102 c.FillPolygon(h.FillColor, c.ClipPolygonXY(pts))
103 }
104 pts = append(pts, vg.Point{X: xmin, Y: ymin})
105 c.StrokeLines(h.LineStyle, c.ClipLinesXY(pts)...)
106 }
107}
108
109// DataRange returns the minimum and maximum X and Y values
110func (h *Histogram) DataRange() (xmin, xmax, ymin, ymax float64) {

Callers

nothing calls this directly

Calls 5

TransformsMethod · 0.80
FillPolygonMethod · 0.80
ClipPolygonXYMethod · 0.80
StrokeLinesMethod · 0.80
ClipLinesXYMethod · 0.80

Tested by

no test coverage detected