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

Method Plot

tensor/stats/clust/plot.go:29–57  ·  view source on GitHub ↗

Plot sets the rows of given data table to trace out lines with labels that will render this node in a cluster plot when plotted with a standard plotting package. The lines double-back on themselves to form a continuous line to be plotted.

(pt *table.Table, smat *simat.SimMat)

Source from the content-addressed store, hash-verified

27// will render this node in a cluster plot when plotted with a standard plotting package.
28// The lines double-back on themselves to form a continuous line to be plotted.
29func (nn *Node) Plot(pt *table.Table, smat *simat.SimMat) {
30 row := pt.Rows
31 if nn.IsLeaf() {
32 pt.SetNumRows(row + 1)
33 pt.SetFloatIndex(0, row, nn.ParDist)
34 pt.SetFloatIndex(1, row, nn.Y)
35 if len(smat.Rows) > nn.Index {
36 pt.SetStringIndex(2, row, smat.Rows[nn.Index])
37 }
38 } else {
39 for _, kn := range nn.Kids {
40 pt.SetNumRows(row + 2)
41 pt.SetFloatIndex(0, row, nn.ParDist)
42 pt.SetFloatIndex(1, row, kn.Y)
43 row++
44 pt.SetFloatIndex(0, row, nn.ParDist+nn.Dist)
45 pt.SetFloatIndex(1, row, kn.Y)
46 kn.Plot(pt, smat)
47 row = pt.Rows
48 pt.SetNumRows(row + 1)
49 pt.SetFloatIndex(0, row, nn.ParDist)
50 pt.SetFloatIndex(1, row, kn.Y)
51 row++
52 }
53 pt.SetNumRows(row + 1)
54 pt.SetFloatIndex(0, row, nn.ParDist)
55 pt.SetFloatIndex(1, row, nn.Y)
56 }
57}
58
59// SetYs sets the Y-axis values for the nodes in preparation for plotting.
60func (nn *Node) SetYs(nextY *float64) {

Callers

nothing calls this directly

Calls 5

IsLeafMethod · 0.95
SetFloatIndexMethod · 0.80
SetStringIndexMethod · 0.80
SetNumRowsMethod · 0.65
PlotMethod · 0.65

Tested by

no test coverage detected