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)
| 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. |
| 29 | func (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. |
| 60 | func (nn *Node) SetYs(nextY *float64) { |
nothing calls this directly
no test coverage detected