WriterTo returns an io.WriterTo that will write the plot as the specified image format. Supported formats are: - .eps - .jpg|.jpeg - .pdf - .png - .svg - .tex - .tif|.tiff
(w, h vg.Length, format string)
| 502 | // - .tex |
| 503 | // - .tif|.tiff |
| 504 | func (p *Plot) WriterTo(w, h vg.Length, format string) (io.WriterTo, error) { |
| 505 | c, err := draw.NewFormattedCanvas(w, h, format) |
| 506 | if err != nil { |
| 507 | return nil, err |
| 508 | } |
| 509 | p.Draw(draw.New(c)) |
| 510 | return c, nil |
| 511 | } |
| 512 | |
| 513 | // Save saves the plot to an image file. The file format is determined |
| 514 | // by the extension. |