MCPcopy Create free account
hub / github.com/cogentcore/core / plotXAxis

Method plotXAxis

plot/plotcore/ploteditor.go:360–384  ·  view source on GitHub ↗

plotXAxis processes the XAxis and returns its index

(plt *plot.Plot, ixvw *table.IndexView)

Source from the content-addressed store, hash-verified

358
359// plotXAxis processes the XAxis and returns its index
360func (pl *PlotEditor) plotXAxis(plt *plot.Plot, ixvw *table.IndexView) (xi int, xview *table.IndexView, err error) {
361 xi, err = ixvw.Table.ColumnIndexTry(pl.Options.XAxis)
362 if err != nil {
363 // log.Println("plot.PlotXAxis: " + err.Error())
364 return
365 }
366 xview = ixvw
367 xc := ixvw.Table.Columns[xi]
368 xp := pl.Columns[xi]
369 sz := 1
370 if xp.Range.FixMin {
371 plt.X.Min = math32.Min(plt.X.Min, float32(xp.Range.Min))
372 }
373 if xp.Range.FixMax {
374 plt.X.Max = math32.Max(plt.X.Max, float32(xp.Range.Max))
375 }
376 if xc.NumDims() > 1 {
377 sz = xc.Len() / xc.DimSize(0)
378 if xp.TensorIndex > sz || xp.TensorIndex < 0 {
379 slog.Error("plotcore.PlotEditor.plotXAxis: TensorIndex invalid -- reset to 0")
380 xp.TensorIndex = 0
381 }
382 }
383 return
384}
385
386const plotColumnsHeaderN = 2
387

Callers 2

genPlotXYMethod · 0.95
genPlotBarMethod · 0.95

Calls 7

MinFunction · 0.92
MaxFunction · 0.92
ColumnIndexTryMethod · 0.80
NumDimsMethod · 0.65
LenMethod · 0.65
DimSizeMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected