Accepted answer

Yes you can do this, the code below shows how I am adding a translate to the g group on clicking of the button: (I have added comments for you to get a better picture of the code)

    //making a g group with in the circle
    var myG ="body").append("svg").attr("width", 500).attr("height", 500).append("g");
    //appending a circle to the g group.
    myG.append("circle").attr("cy", 60).attr("cx", 60).attr("r",10);

    var xTrans = 0;"#click").on("click", function() {
        //applying transform to g.
    	myG.attr("transform", "translate("+xTrans+",0)")
<script src=""></script>
<button id="click">ClickToAddTransition</button>

Related Query

More Query from same tag