I find it is easier for me to write R code from Python to be executed later than it is to write R code as text that needs to sort or manipulate values to do various things. And I really doubt that you care exactly how I achieved this. (Let me know if you want a copy of the Python script). Here is a small taste of it.
Some code I write as text and load into Python to combine with the other parts:
In this part, we go through each eNode, recover its x-position and the x-position of its parent node, and write the instruction that will draw a line connecting it those two points.
The ta-ta-ta-taa (Melvin video at 2:51) figure is here:
You can compare it with the original plot by the APE package:
And here is the listing for the R code: