code: def _repr_html_(self):
          
          vis_id = str(uuid4()).replace("-", "")
          html = """<div id="vis%s"></div>
  <script>
     ( function() {
       var _do_plot = function() {
         if (typeof vg === 'undefined') {
           window.addEventListener('vincent_libs_loaded', _do_plot)
           return;
         }
         vg.parse.spec(%s, function(chart) {
           chart({el: "#vis%s"}).update();
         });
       };
       _do_plot();
     })();
  </script>
  <style>.vega canvas {width: 100%%;}</style>
          """ % (vis_id, self.to_json(pretty_print=False), vis_id)
          return html
docs: Build the HTML representation for IPython.