| 56 | } |
| 57 | |
| 58 | func 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 | } |