draw

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2021 License: GPL-2.0 Imports: 18 Imported by: 1

Documentation

Overview

Package intended to draw phylogenetic trees on different devices :

  • Terminal,
  • Images (svg, png)
  • ...

And with different drawing algorithms. So far, only ASCII form in terminal.

  • Circular
  • Normal
  • Unrooted

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TreeDrawer

type TreeDrawer interface {
	SetMaxValues(maxObjectWidth, maxObjectHeight float64, maxNameLength, maxNameHeight int)
	DrawHLine(x1, x2, y float64)
	DrawVLine(x, y1, y float64)
	DrawLine(x1, y1, x2, y2 float64)
	DrawCurve(centerx, centery float64, middlex, middley float64, radius float64, startAngle, endAngle float64)
	DrawCircle(x, y float64)
	/* angle : angle of the tip incoming branch */
	DrawName(x, y float64, name string, angle float64)
	Write()
	Bounds() (int, int) /* width, height*/
}

Generic struct to draw on different supports:

  • ascii in terminal
  • png
  • svg

func NewPngTreeDrawer

func NewPngTreeDrawer(w io.Writer, width, height int, leftmargin, rightmargin, topmargin, bottommargin int, fillbackground bool) TreeDrawer

TextTreeDrawer initializer. TextTreeDraws draws tree as ASCII on stdout or any file. So far: Does not take into account branch lengths.

func NewSvgTreeDrawer

func NewSvgTreeDrawer(w io.Writer, width, height int,
	leftmargin, rightmargin, topmargin, bottommargin int) TreeDrawer

TextTreeDrawer initializer. TextTreeDraws draws tree as ASCII on stdout or any file. So far: Does not take into account branch lengths.

func NewTextTreeDrawer

func NewTextTreeDrawer(w io.Writer, width, height int, rightmargin int) TreeDrawer

TextTreeDrawer initializer. TextTreeDraws draws tree as ASCII on stdout or any file. So far: Does not take into account branch lengths.

type TreeLayout

type TreeLayout interface {
	DrawTree(t *tree.Tree) error
	SetSupportCutoff(float64)
	SetDisplayInternalNodes(bool)
	SetDisplayNodeComments(bool)
}

Generic struct that represents tree layout:

  • circular
  • normal
  • unrooted

func NewCircularLayout

func NewCircularLayout(td TreeDrawer, withBranchLengths, withTipLabels, withInternalNodeLabel, withSupportCircles bool) TreeLayout

If withSuppportCircles is true, then it will draw circles on branches whose support is > 0.7. The cutoff may be set with layout.SetSupportCutoff()

func NewCytoscapeLayout added in v0.2.4

func NewCytoscapeLayout(writer *bufio.Writer, hasSupport bool) TreeLayout

func NewNormalLayout

func NewNormalLayout(td TreeDrawer, withBranchLengths, withTipLabels, withInternalNodeLabel, withSupportCircles bool) TreeLayout

func NewRadialLayout

func NewRadialLayout(td TreeDrawer, withBranchLengths, withTipLabels, withInternalNodeLabels, withSuppportCircles bool) TreeLayout

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL