How to draw a Tree/Cladogram with Vega?

466 views
Skip to first unread message

Yuri Astrakhan

unread,
Dec 21, 2015, 6:06:53 PM12/21/15
to vega-js
Hi, what is the easiest way to draw a simple Cladogram with Vega? Thanks!

Roy I

unread,
Dec 23, 2015, 8:02:42 AM12/23/15
to vega-js


Vega v2.4.0/2.4.2 includes new "treeify" transform:

Examples of Vega spec for treeify (by Jeff Heer):

The online Vega editor has not been updated yet to this latest version:

Examples

1. Radial tree


2. Cartesian tree with absolute sizing


5. Cluster dendrogram


6. Radial dendrogram:

Yuri Astrakhan

unread,
Dec 24, 2015, 8:03:27 AM12/24/15
to vega-js
Roy, this is amazing, thank you!!!  I suspect that the only difficulty now is how to make this into a clickable version -- we currently render everything on the server as PNGs, or allow "click to interact" (play) button which loads vega and data to the client (which is slow).  But if all we want is to draw a cladogram with labels, SVG would be the best option -- we draw it as an SVG on the server, and that SVG would have links as tree nodes.  We will also have to finish our SVG sanitization system to prevent any malicious code in the SVG output.

Yuri Astrakhan

unread,
Dec 24, 2015, 8:09:52 AM12/24/15
to vega-js
P.S. The online Vega editor has bee updated to 2.4.2, but those graph specs have to be copy/pasted.
Reply all
Reply to author
Forward
0 new messages