title: D3: Setting selection transform attribute in a nicer way
body: <p>I've been working with d3 for a while, but it bothers me that everytime I want to apply a translation to a d3 selection, I do it like this:</p>
  
  <pre><code> var svg = d3
          .select("svg")
          .attr("transform", "translate(0,$1)".replace("$1", "" + (someHeight)))
  </code></pre>
  
  <p><em>Note: <code>someHeight</code> is usually a calculation or else I would use string concatenation, I just think it reads better like this.</em></p>
  
  <p>I've been trying to find if there's a better way to set the transform, maybe through another API other than <code>attr</code></p>
  
  <p>Let me know if the question needs better explaining.</p>
  
  <p>Kind regards.</p>