MCPcopy Index your code
hub / github.com/gonum/plot / ExampleReverse

Function ExampleReverse

palette/reverse_example_test.go:19–36  ·  view source on GitHub ↗

This example creates a color bar and a second color bar where the direction of the colors are reversed.

()

Source from the content-addressed store, hash-verified

17// This example creates a color bar and a second color bar where the
18// direction of the colors are reversed.
19func 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.
39func ExampleReverse_palette() {

Callers

nothing calls this directly

Calls 8

NewFunction · 0.92
KindlmannFunction · 0.92
ReverseFunction · 0.92
HideYMethod · 0.80
SaveMethod · 0.80
SetMinMethod · 0.65
SetMaxMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected