In [3]:
from IPython.display import SVG
from IPython.display import HTML

In [2]:
svg = """<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">

<svg width="100%" height="200%">
<defs>
  <radialGradient id="gradientDefinition"
     gradientUnits="userSpaceOnUse">
     <stop stop-color="yellow" offset="0%"/>
     <stop stop-color="black"  offset="100%"/>
  </radialGradient>
  </defs>

  <ellipse
     cx="265" cy="165" rx="200" ry="100"
     stroke-dasharray="1 1 1 1"
     stroke="white"
     stroke-width="4"
     fill="black"/>

  <ellipse
     cx="250" cy="150" rx="200" ry="100"
     stroke="white"
     stroke-width="1"
     stroke-dasharray="1 1 1 1"
     style="fill:url(#gradientDefinition)"/>
</svg>"""

In [5]:
SVG(filename="C:\Users\chaithcock\Desktop\svg_001.svg")


  File "<ipython-input-5-88f1de42f32f>", line 1
    SVG(filename="C:\Users\chaithcock\Desktop\svg_001.svg")
                ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

In [4]:
HTML(svg)


Out[4]:

In [66]:
HTML("""<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">

<svg width="400" height="400"
  xmlns="http://www.w3.org/2000/svg" >
<title>Cat</title>
<desc>Stick Figure of a Cat</desc>

<!-- outer rectangle -->
  <rect x="10" y="70" width="300" height="300"
    style="fill: #D3D3D3;
      stroke: black; stroke-width: 2; stroke-opacity: 0.5;"/>
 
 <line x1="60" y1="70" x2="60" y2="370" style="stroke: black;"/>
 <line x1="110" y1="70" x2="110" y2="370" style="stroke: black;"/>
 <line x1="160" y1="70" x2="160" y2="370" style="stroke: black;"/>
 <line x1="210" y1="70" x2="210" y2="370" style="stroke: black;"/>
 <line x1="260" y1="70" x2="260" y2="370" style="stroke: black;"/>
 
 <line x1="10" y1="120" x2="310" y2="120" style="stroke: black;"/>
 <line x1="10" y1="170" x2="310" y2="170" style="stroke: black;"/>
 <line x1="10" y1="220" x2="310" y2="220" style="stroke: black;"/>
 <line x1="10" y1="270" x2="310" y2="270" style="stroke: black;"/>
 <line x1="10" y1="320" x2="310" y2="320" style="stroke: black;"/>
 
 <rect x="61" y="171" width="98" height="48" rx="5"
    style="stroke: none; fill: red;"/>
    
 <rect x="61" y="271" width="98" height="48" rx="5"
    style="stroke: none; fill: green"/>

 <text x="111" y="195" style="alignment-baseline:middle;font-size:18pt;font-weight:bold;text-anchor: middle">X</text>

</svg>""")


Out[66]:
Cat Stick Figure of a Cat X

In [ ]:


In [ ]:


In [ ]:


In [ ]:


In [ ]: