...

Source file src/gonum.org/v1/plot/vg/draw/split_vertical_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_splitVertical() {
    16  	c := draw.New(vgimg.New(vg.Points(10), vg.Points(16)))
    17  
    18  	// Split c along a horizontal line centered on the canvas.
    19  	bottom, top := SplitVertical(c, c.Size().Y/2)
    20  	fmt.Printf("top:    %#v\n", top.Rectangle)
    21  	fmt.Printf("bottom: %#v\n", bottom.Rectangle)
    22  
    23  	// Output:
    24  	// top:    vg.Rectangle{Min:vg.Point{X:0, Y:8}, Max:vg.Point{X:10, Y:16}}
    25  	// bottom: vg.Rectangle{Min:vg.Point{X:0, Y:0}, Max:vg.Point{X:10, Y:8}}
    26  }
    27  

View as plain text