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

Method Thumbnail

legend_example_test.go:22–38  ·  view source on GitHub ↗

Thumbnail fulfills the plot.Thumbnailer interface.

(c *draw.Canvas)

Source from the content-addressed store, hash-verified

20
21// Thumbnail fulfills the plot.Thumbnailer interface.
22func (et exampleThumbnailer) Thumbnail(c *draw.Canvas) {
23 pts := []vg.Point{
24 {X: c.Min.X, Y: c.Min.Y},
25 {X: c.Min.X, Y: c.Max.Y},
26 {X: c.Max.X, Y: c.Max.Y},
27 {X: c.Max.X, Y: c.Min.Y},
28 }
29 poly := c.ClipPolygonY(pts)
30 c.FillPolygon(et.Color, poly)
31
32 pts = append(pts, vg.Point{X: c.Min.X, Y: c.Min.Y})
33 outline := c.ClipLinesY(pts)
34 c.StrokeLines(draw.LineStyle{
35 Color: color.Black,
36 Width: vg.Points(1),
37 }, outline...)
38}
39
40// This example creates a some standalone legends with borders around them.
41func ExampleLegend_standalone() {

Callers

nothing calls this directly

Calls 5

PointsFunction · 0.92
ClipPolygonYMethod · 0.80
FillPolygonMethod · 0.80
ClipLinesYMethod · 0.80
StrokeLinesMethod · 0.80

Tested by

no test coverage detected