An example of embedding a uniform image in a plot.
()
| 84 | |
| 85 | // An example of embedding a uniform image in a plot. |
| 86 | func ExampleImage_uniform() { |
| 87 | p := plot.New() |
| 88 | p.Title.Text = "Uniform image" |
| 89 | |
| 90 | img := image.NewUniform(color.RGBA{R: 90, G: 155, B: 212, A: 255}) |
| 91 | p.Add(plotter.NewImage(img, 100, 100, 10000, 10000)) |
| 92 | |
| 93 | const ( |
| 94 | w = 5 * vg.Centimeter |
| 95 | h = 5 * vg.Centimeter |
| 96 | ) |
| 97 | |
| 98 | err := p.Save(w, h, "testdata/image_plot_uniform.png") |
| 99 | if err != nil { |
| 100 | log.Fatalf("error saving image plot: %v\n", err) |
| 101 | } |
| 102 | } |