...

Source file src/gonum.org/v1/plot/vg/draw/split_horiz_example_test.go

Documentation: gonum.org/v1/plot/vg/draw

     1  // Copyright ©2017 The Gonum Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package draw_test
     6  
     7  import (
     8  	"fmt"
     9  
    10  	"gonum.org/v1/plot/vg"
    11  	"gonum.org/v1/plot/vg/draw"
    12  	"gonum.org/v1/plot/vg/vgimg"
    13  )
    14  
    15  func ExampleCrop_splitHorizontal() {
    16  	c := draw.New(vgimg.New(vg.Points(10), vg.Points(16)))
    17  
    18  	// Split c along a vertical line centered on the canvas.
    19  	left, right := SplitHorizontal(c, c.Size().X/2)
    20  	fmt.Printf("left:  %#v\n", left.Rectangle)
    21  	fmt.Printf("right: %#v\n", right.Rectangle)
    22  
    23  	// Output:
    24  	// left:  vg.Rectangle{Min:vg.Point{X:0, Y:0}, Max:vg.Point{X:5, Y:16}}
    25  	// right: vg.Rectangle{Min:vg.Point{X:5, Y:0}, Max:vg.Point{X:10, Y:16}}
    26  }
    27  

View as plain text