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

Function Crop

vg/draw/canvas.go:373–386  ·  view source on GitHub ↗

Crop returns a new Canvas corresponding to the Canvas c with the given lengths added to the minimum and maximum x and y values of the Canvas's Rectangle. Note that cropping the right and top sides of the canvas requires specifying negative values of right and top.

(c Canvas, left, right, bottom, top vg.Length)

Source from the content-addressed store, hash-verified

371// Note that cropping the right and top sides of the canvas
372// requires specifying negative values of right and top.
373func Crop(c Canvas, left, right, bottom, top vg.Length) Canvas {
374 minpt := vg.Point{
375 X: c.Min.X + left,
376 Y: c.Min.Y + bottom,
377 }
378 maxpt := vg.Point{
379 X: c.Max.X + right,
380 Y: c.Max.Y + top,
381 }
382 return Canvas{
383 Canvas: c,
384 Rectangle: vg.Rectangle{Min: minpt, Max: maxpt},
385 }
386}
387
388// Tiles creates regular subcanvases from a Canvas.
389type Tiles struct {

Callers 9

AlignFunction · 0.92
DrawMethod · 0.92
DataCanvasMethod · 0.92
DrawGlyphBoxesMethod · 0.92
ExampleScatter_colorFunction · 0.92
ExampleHeatMapFunction · 0.92
SplitHorizontalFunction · 0.92
SplitVerticalFunction · 0.92
TestCropFunction · 0.92

Calls

no outgoing calls

Tested by 5

ExampleScatter_colorFunction · 0.74
ExampleHeatMapFunction · 0.74
SplitHorizontalFunction · 0.74
SplitVerticalFunction · 0.74
TestCropFunction · 0.74