title: How to generate D3.js circular dendrogram code from Python
body: <p>The following figure is generated with D3.js. </p>
  
  <p><img src="https://i.stack.imgur.com/dXQBf.jpg" alt="enter image description here"></p>
  
  <p>based on the code <a href="http://bl.ocks.org/mbostock/4339607" rel="noreferrer">here</a>:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Flare Dendrogram&lt;/title&gt;
  &lt;style&gt;
  
  .node circle {
    fill: #fff;
    stroke: steelblue;
    stroke-width: 1.5px;
  }
  
  .node {
    font: 10px sans-serif;
  }
  
  .link {
    fill: none;
    stroke: #ccc;
    stroke-width: 1.5px;
  }
  
  &lt;/style&gt;
  &lt;body&gt;
  &lt;script src="http://d3js.org/d3.v3.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  
  var radius = 960 / 2;
  
  var cluster = d3.layout.cluster()
      .size([360, radius - 120]);
  
  var diagonal = d3.svg.diagonal.radial()
      .projection(function(d) { return [d.y, d.x / 180 * Math.PI]; });
  
  var svg = d3.select("body").append("svg")
      .attr("width", radius * 2)
      .attr("height", radius * 2)
    .append("g")
      .attr("transform", "translate(" + radius + "," + radius + ")");
  
  d3.json("/d/4063550/flare.json", function(error, root) {
    var nodes = cluster.nodes(root);
  
    var link = svg.selectAll("path.link")
        .data(cluster.links(nodes))
      .enter().append("path")
        .attr("class", "link")
        .attr("d", diagonal);
  
    var node = svg.selectAll("g.node")
        .data(nodes)
      .enter().append("g")
        .attr("class", "node")
        .attr("transform", function(d) { return "rotate(" + (d.x - 90) + ")translate(" + d.y + ")"; })
  
    node.append("circle")
        .attr("r", 4.5);
  
    node.append("text")
        .attr("dy", ".31em")
        .attr("text-anchor", function(d) { return d.x &lt; 180 ? "start" : "end"; })
        .attr("transform", function(d) { return d.x &lt; 180 ? "translate(8)" : "rotate(180)translate(-8)"; })
        .text(function(d) { return d.name; });
  });
  
  d3.select(self.frameElement).style("height", radius * 2 + "px");
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Is there a way I can use Python to generate the above exact figure (HTML)?</p>