This example creates a color bar and a second color bar where the direction of the colors are reversed.
()
| 17 | // This example creates a color bar and a second color bar where the |
| 18 | // direction of the colors are reversed. |
| 19 | func ExampleReverse() { |
| 20 | p := plot.New() |
| 21 | l := &plotter.ColorBar{ColorMap: moreland.Kindlmann()} |
| 22 | l2 := &plotter.ColorBar{ColorMap: palette.Reverse(moreland.Kindlmann())} |
| 23 | l.ColorMap.SetMin(0.5) |
| 24 | l.ColorMap.SetMax(2.5) |
| 25 | l2.ColorMap.SetMin(2.5) |
| 26 | l2.ColorMap.SetMax(4.5) |
| 27 | |
| 28 | p.Add(l, l2) |
| 29 | p.HideY() |
| 30 | p.X.Padding = 0 |
| 31 | p.Title.Text = "A ColorMap and its Reverse" |
| 32 | |
| 33 | if err := p.Save(300, 48, "testdata/reverse.png"); err != nil { |
| 34 | log.Panic(err) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | // This example creates a color palette from a reversed ColorMap. |
| 39 | func ExampleReverse_palette() { |