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

Method NominalX

plot.go:447–457  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

445// that do not end up in range of the X axis will not have
446// tick marks.
447func (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.
460func (p *Plot) HideX() {

Callers 7

ExampleBoxPlotFunction · 0.80
ExampleQuartPlotFunction · 0.80
ExampleSankey_simpleFunction · 0.80
ExampleSankey_groupedFunction · 0.80
Example_rotationFunction · 0.80
ExampleBarChartFunction · 0.80
AddBoxPlotsFunction · 0.80

Calls 2

ConstantTicksTypeAlias · 0.85
WidthMethod · 0.45

Tested by 6

ExampleBoxPlotFunction · 0.64
ExampleQuartPlotFunction · 0.64
ExampleSankey_simpleFunction · 0.64
ExampleSankey_groupedFunction · 0.64
Example_rotationFunction · 0.64
ExampleBarChartFunction · 0.64