Package vgtex provides a vg.Canvas implementation for LaTeX, targeted at the TikZ/PGF LaTeX package:

    vgtex generates PGF instructions that will be interpreted and rendered by LaTeX. vgtex allows to put any valid LaTeX notation inside plot's strings.


      An example of making a LaTeX plot.





      This section is empty.


      This section is empty.


      This section is empty.


      type Canvas

      type Canvas struct {
      	// contains filtered or unexported fields

        Canvas implements the vg.Canvas interface, translating drawing primitives from gonum/plot to PGF.

        func New

        func New(w, h vg.Length) *Canvas

          New returns a new LaTeX canvas.

          func NewDocument

          func NewDocument(w, h vg.Length) *Canvas

            NewDocument returns a new LaTeX canvas that can be readily compiled into a standalone document.

            func (*Canvas) DrawImage

            func (c *Canvas) DrawImage(rect vg.Rectangle, img image.Image)

              DrawImage implements the vg.Canvas.DrawImage method. DrawImage will first save the image inside a PNG file and have the generated LaTeX reference that file. The file name will be "gonum-pgf-image-<canvas-id>-<time.Now()>.png

              func (*Canvas) Fill

              func (c *Canvas) Fill(p vg.Path)

                Fill implements the vg.Canvas.Fill method.

                func (*Canvas) FillString

                func (c *Canvas) FillString(f vg.Font, pt vg.Point, text string)

                  FillString implements the vg.Canvas.FillString method.

                  func (*Canvas) Pop

                  func (c *Canvas) Pop()

                    Pop implements the vg.Canvas.Pop method.

                    func (*Canvas) Push

                    func (c *Canvas) Push()

                      Push implements the vg.Canvas.Push method.

                      func (*Canvas) Rotate

                      func (c *Canvas) Rotate(rad float64)

                        Rotate implements the vg.Canvas.Rotate method.

                        func (*Canvas) Scale

                        func (c *Canvas) Scale(x, y float64)

                          Scale implements the vg.Canvas.Scale method.

                          func (*Canvas) SetColor

                          func (c *Canvas) SetColor(clr color.Color)

                            SetColor implements the vg.Canvas.SetColor method.

                            func (*Canvas) SetLineDash

                            func (c *Canvas) SetLineDash(pattern []vg.Length, offset vg.Length)

                              SetLineDash implements the vg.Canvas.SetLineDash method.

                              func (*Canvas) SetLineWidth

                              func (c *Canvas) SetLineWidth(w vg.Length)

                                SetLineWidth implements the vg.Canvas.SetLineWidth method.

                                func (*Canvas) Size

                                func (c *Canvas) Size() (w, h vg.Length)

                                  Size returns the width and height of the canvas.

                                  func (*Canvas) Stroke

                                  func (c *Canvas) Stroke(p vg.Path)

                                    Stroke implements the vg.Canvas.Stroke method.

                                    func (*Canvas) Translate

                                    func (c *Canvas) Translate(pt vg.Point)

                                      Translate implements the vg.Canvas.Translate method.

                                      func (*Canvas) WriteTo

                                      func (c *Canvas) WriteTo(w io.Writer) (int64, error)

                                        WriteTo implements the io.WriterTo interface, writing a LaTeX/pgf plot.

                                        Source Files