In [1]:
from IPython.display import HTML
In [2]:
HTML("""
<html>
<body>
<svg width="100" height="100">
<text x="10" y="10">
John
</text>
</svg>
</body>
</html>
""")
Out[2]:
In [3]:
HTML("""
<html>
<body>
<svg width="100" height="100">
<text x="10" y="10" fill = "red">
John
</text>
</svg>
</body>
</html>
""")
Out[3]:
In [4]:
HTML("""
<html>
<body>
<svg width="100" height="100">
<text x="10" y="10" fill = "red" font-size="40">
John
</text>
</svg>
</body>
</html>
""")
Out[4]:
In [5]:
HTML("""
<html>
<body>
<svg width="200" height="200">
<text x="50" y="50" fill = "red" font-size="40">
John
</text>
</svg>
</body>
</html>
""")
Out[5]:
In [6]:
HTML("""
<html>
<body>
<svg width="200" height="200">
<text x="50" y="50" fill = "red" font-size="40" font-weight="bold">
John
</text>
</svg>
</body>
</html>
""")
Out[6]:
In [7]:
HTML("""
<html>
<body>
<svg width="200" height="200">
<text x="50" y="50" fill = "red" font-size="40" font-weight="bold" transform="rotate(0)" >
John
</text>
</svg>
</body>
</html>
""")
Out[7]:
In [8]:
HTML("""
<html>
<body>
<svg width="200" height="200">
<text x="50" y="50" fill = "red" font-size="40" font-weight="bold" transform="rotate(30)" >
John
</text>
</svg>
</body>
</html>
""")
Out[8]:
In [9]:
HTML("""
<html>
<body>
<svg width="200" height="200">
<text x="50" y="50" fill = "red" font-size="40" font-weight="bold" transform="rotate(50)" >
John
</text>
</svg>
</body>
</html>
""")
Out[9]:
In [10]:
HTML("""
<html>
<body>
<svg width="200" height="200">
<text x="50" y="50" fill = "red" font-size="40" font-weight="bold" transform="rotate(100,50,50)">
John
</text>
</svg>
</body>
</html>
""")
Out[10]:
In [11]:
HTML("""
<html>
<body>
<svg width="200" height="200">
<text x="50" y="50" fill = "red" font-size="40" font-weight="bold" transform="rotate(180,50,50)">
John
</text>
</svg>
</body>
</html>
""")
Out[11]:
In [12]:
HTML("""
<html>
<body>
<svg width="200" height="200">
<text x="100" y="50" fill = "red" font-size="40" font-weight="bold" transform="rotate(180,100,50)">
John
</text>
</svg>
</body>
</html>
""")
Out[12]:
In [13]:
HTML("""
<html>
<body>
<svg width="500" height="200">
<text x="100" y="50" font-size="30">
Cat sat on the chair
</text>
</svg>
</body>
</html>
""")
Out[13]:
In [14]:
HTML("""
<html>
<body>
<svg width="500" height="200">
<text x="100" y="50" font-size="30">
<tspan fill = "red">
Cat
</tspan>
sat on the chair
</text>
</svg>
</body>
</html>
""")
Out[14]:
In [15]:
HTML("""
<html>
<body>
<svg width="500" height="200">
<text x="100" y="100" font-size="30">
Cat sat on the
<tspan dy="20" fill = "red">
chair
</tspan>
</text>
</svg>
</body>
</html>
""")
Out[15]:
In [16]:
HTML("""
<html>
<body>
<svg width="500" height="200">
<text x="100" y="100" font-size="30">
Cat sat on the
<tspan dy="-20" fill = "red">
chair
</tspan>
</text>
</svg>
</body>
</html>
""")
Out[16]:
In [17]:
HTML("""
<html>
<body>
<svg width="500" height="200">
<text x="100" y="100" font-size="30">
sat on the
<tspan dy="-20" fill = "red">
chair
</tspan>
</text>
<image href="/static/images/nutan/blog/svg/svg-text/cat.jpg" height="200" width="200"/>
</svg>
</body>
</html>
""")
Out[17]:
In [18]:
HTML("""
<html>
<body>
<svg width="500" height="200">
<text x="200" y="100" font-size="30">
sat on the
<tspan dy="-20" fill = "red">
chair
</tspan>
</text>
<image href="cat.jpg" height="200" width="200"/>
</svg>
</body>
</html>
""")
Out[18]:
In [19]:
HTML("""
<html>
<body>
<svg width="500" height="200">
<path id="MyPath" fill="none" stroke="red"
d="M10,90 Q90,90 90,45 Q90,10 50,10 Q10,10 10,40 Q10,70 45,70 Q70,70 75,50" />
<text>
<textPath href="#MyPath">
Cat sat on the chair
</textPath>
</text>
</svg>
</body>
</html>
""")
Out[19]: