U
    TZßfÁ  ã                   @   s   d Z dd„ ZdS )z%
Tools for matplotlib plot exporting
c            
      C   s|   zddl m} m} W n tk
r0   tdƒ Y nX d}d}d}d}d}d	||||f }| |¡}d
| d }	| ||	ƒƒ dS )z¤Initialize the IPython notebook display elements

    This function borrows heavily from the excellent vincent package:
    http://github.com/wrobstory/vincent
    é    )ÚdisplayÚHTMLz%IPython Notebook could not be loaded.aç  
    if (window['d3'] === undefined) {{
        require.config({{ paths: {{d3: "http://d3js.org/d3.v3.min"}} }});
        require(["d3"], function(d3) {{
          window.d3 = d3;
          {0}
        }});
    }};
    if (window['topojson'] === undefined) {{
        require.config(
            {{ paths: {{topojson: "http://d3js.org/topojson.v1.min"}} }}
            );
        require(["topojson"], function(topojson) {{
          window.topojson = topojson;
        }});
    }};
    z+http://d3js.org/d3.geo.projection.v0.min.jsz6http://wrobstory.github.io/d3-cloud/d3.layout.cloud.jsz"http://d3js.org/topojson.v1.min.jsz'http://trifacta.github.com/vega/vega.jsa   $.getScript("%s", function() {
        $.getScript("%s", function() {
            $.getScript("%s", function() {
                $.getScript("%s", function() {
                        $([IPython.events]).trigger("vega_loaded.vincent");
                })
            })
        })
    });z<script>z	</script>N)ZIPython.core.displayr   r   ÚImportErrorÚprintÚformat)
r   r   Z
require_jsZd3_geo_projection_js_urlZd3_layout_cloud_js_urlZtopojson_js_urlZvega_js_urlZdep_libsZload_jsÚhtml© r   úI/tmp/pip-unpacked-wheel-5ksk5baj/plotly/matplotlylib/mplexporter/tools.pyÚipynb_vega_init   s&    	üø
r
   N)Ú__doc__r
   r   r   r   r	   Ú<module>   s   