Skip to content

Instantly share code, notes, and snippets.

@uredkar
Created December 4, 2016 02:15
Show Gist options
  • Save uredkar/3d15241cb94085472df3e751f469d39b to your computer and use it in GitHub Desktop.
Save uredkar/3d15241cb94085472df3e751f469d39b to your computer and use it in GitHub Desktop.
Simple tree
license: mit
<!DOCTYPE html>
<head>
<link rel="stylesheet" href="http://tntvis.github.io/tnt.tree/build/tnt.tree.css" type="text/css" />
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://tntvis.github.io/tnt.tree/build/tnt.tree.min.js"></script>
</head>
<body>
<div id="mydiv"></div>
<script>
// newick tree
var newick = "(((C.elegans,Fly),(((((((((Tasmanian Devil,Wallaby,Opossum),((Armadillo,Sloth),(Rock hyrax,Tenrec,Elephant),(((Rabbit,Pika),(((Rat,Mouse),Kangaroo rat,Squirrel),Guinea Pig)),((Mouse lemur,Bushbaby),((((((Chimp,Human,Gorilla),Orangutan),Gibbon),Macaque),Marmoset),Tarsier)),Tree Shrew),((Microbat,Flying fox),(Hedgehog,Shrew),((Panda,Dog,Domestic ferret),Cat),((Cow,Sheep),Pig,Alpaca,Dolphin),Horse))),Platypus),((((Collared flycatcher,Zebra finch),(Chicken,Turkey),Duck),Chinese softshell turtle),Anole lizard)),Xenopus),Coelacanth),(((Zebrafish,Cave fish),((((Medaka,Platyfish),Stickleback),(Fugu,Tetraodon),Tilapia),Cod)),Spotted gar)),Lamprey),(C.savignyi,C.intestinalis))),S.cerevisiae);";
var tree = tnt.tree();
tree
.data(tnt.tree.parse_newick(newick))
.node_display(tree.node_display()
.size(4)
.fill("#888888")
)
.label (tnt.tree.label.text()
.fontsize(12)
.height(24)
)
.layout(tnt.tree.layout.vertical()
.width(650)
.scale(false)
);
tree(document.getElementById("mydiv"));
</script>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment