Edit on
<head>
  <!-- Plotly.js -->
  <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
</head>

<body>  
  <div id="myDiv" style:width: 100%><!-- Plotly chart will be drawn inside this DIV --></div>
  <script>
    <!-- JAVASCRIPT CODE GOES HERE -->
  </script>
</body>
var myPlot = document.getElementById('myDiv'),
    d3 = Plotly.d3,
    N = 20,
    x = d3.range(N),
    y = d3.range(N).map( d3.random.normal() ),
    data = [{x:x, y:y, type:'scatter',
            mode:'markers', marker:{size:14}}
           ];

Plotly.plot('myDiv', data);

myPlot.on('plotly_afterplot', function(){
    console.log('done plotting');
});
Rerun