NominalX configures the plot to have a nominal X axis—an X axis with names instead of numbers. The X location corresponding to each name are the integers, e.g., the x value 0 is centered above the first name and 1 is above the second name, etc. Labels for x values that do not end up in range of th
(names ...string)
| 445 | // that do not end up in range of the X axis will not have |
| 446 | // tick marks. |
| 447 | func (p *Plot) NominalX(names ...string) { |
| 448 | p.X.Tick.Width = 0 |
| 449 | p.X.Tick.Length = 0 |
| 450 | p.X.Width = 0 |
| 451 | p.Y.Padding = p.X.Tick.Label.Width(names[0]) / 2 |
| 452 | ticks := make([]Tick, len(names)) |
| 453 | for i, name := range names { |
| 454 | ticks[i] = Tick{float64(i), name} |
| 455 | } |
| 456 | p.X.Tick.Marker = ConstantTicks(ticks) |
| 457 | } |
| 458 | |
| 459 | // HideX configures the X axis so that it will not be drawn. |
| 460 | func (p *Plot) HideX() { |