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

Function ExampleHistogram_logScaleY

plotter/histogram_example_test.go:58–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

56}
57
58func ExampleHistogram_logScaleY() {
59 p := plot.New()
60 p.Title.Text = "Histogram in log-y"
61 p.Y.Scale = plot.LogScale{}
62 p.Y.Tick.Marker = plot.LogTicks{Prec: -1}
63 p.Y.Label.Text = "Y"
64 p.X.Label.Text = "X"
65
66 h1, err := plotter.NewHist(plotter.Values{
67 -2, -2,
68 -1,
69 +3, +3, +3, +3,
70 +1, +1, +1, +1, +1, +1, +1, +1, +1, +1,
71 +1, +1, +1, +1, +1, +1, +1, +1, +1, +1,
72 }, 16)
73 if err != nil {
74 log.Fatal(err)
75 }
76 h1.LogY = true
77 h1.FillColor = color.RGBA{255, 0, 0, 255}
78
79 h2, err := plotter.NewHist(plotter.Values{
80 -3, -3, -3,
81 +2, +2, +2, +2, +2,
82 }, 16)
83
84 if err != nil {
85 log.Fatal(err)
86 }
87
88 h2.LogY = true
89 h2.FillColor = color.RGBA{0, 0, 255, 255}
90
91 p.Add(h1, h2, plotter.NewGrid())
92
93 err = p.Save(200, 200, "testdata/histogram_logy.png")
94 if err != nil {
95 log.Fatal(err)
96 }
97}

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
NewHistFunction · 0.92
NewGridFunction · 0.92
SaveMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected