In [1]:
from IPython.display import HTML
In [2]:
HTML("""hello
""")
Out[2]:
In [3]:
HTML("""
<html>
<body>
<h1>Draw Circle</h1>
</body>
</html>
""")
Out[3]:
In [4]:
HTML("""
<html>
<body>
<h1>Draw Circle</h1>
<svg width="100" height="100">
</svg>
</body>
</html>
""")
Out[4]:
In [5]:
HTML("""
<html>
<body>
<h3>Draw Circle</h3>
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" fill="red" />
</svg>
</body>
</html>
""")
Out[5]:
In [6]:
HTML("""
<html>
<body>
<h3>Draw more bigger circle</h3>
<svg width="200" height="200">
<circle cx="100" cy="100" r="80" fill="red" />
</svg>
</body>
</html>
""")
Out[6]:
In [7]:
HTML("""
<html>
<body>
<h3>Draw circle with outline</h3>
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" fill="red" stroke="blue" />
</svg>
</body>
</html>
""")
Out[7]:
In [8]:
HTML("""
<html>
<body>
<h3>Draw circle with outline</h3>
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" fill="red" stroke="blue" stroke-width="3" />
</svg>
</body>
</html>
""")
Out[8]:
In [9]:
HTML("""
<html>
<body>
<h3>Draw square</h3>
<svg width="500" height="200">
<rect width="150" height="150" fill="cyan" />
</svg>
</body>
</html>
""")
Out[9]:
In [10]:
HTML("""
<html>
<body>
<h3>Draw square with x and y position</h3>
<svg width="500" height="200">
<rect x="50" y="10" width="150" height="150" fill="cyan" />
</svg>
</body>
</html>
""")
Out[10]:
In [11]:
HTML("""
<html>
<body>
<h3>Draw square with x, y position and border</h3>
<svg width="500" height="200">
<rect x="50" y="10" width="150" height="150" fill="cyan" stroke-width="5" stroke="red" />
</svg>
</body>
</html>
""")
Out[11]:
In [12]:
HTML("""
<html>
<body>
<h3>Draw square with x, y position and border</h3>
<svg width="500" height="200">
<rect x="50" y="10" width="150" height="150" fill="cyan" stroke-width="5" stroke="red" fill-opacity="0.1" />
</svg>
</body>
</html>
""")
Out[12]:
In [13]:
HTML("""
<html>
<body>
<h3>Draw square with x, y position and round border</h3>
<svg width="500" height="200">
<rect x="50" y="10" rx="20" ry="20" width="150" height="150" fill="cyan" stroke-width="5" stroke="red" fill-opacity="0.1" />
</svg>
</body>
</html>
""")
Out[13]:
In [14]:
HTML("""
<html>
<body>
<h3>Draw multiple squares</h3>
<svg width="500" height="200">
<rect x="50" y="10" rx="20" ry="20" width="150" height="150" fill="cyan" stroke-width="5" stroke="red" fill-opacity="0.1" />
<rect x="70" y="20" rx="20" ry="20" width="150" height="150" fill="green" stroke-width="5" stroke="red" />
</svg>
</body>
</html>
""")
Out[14]:
In [15]:
HTML("""
<html>
<body>
<h3>Draw squares</h3>
<svg width="500" height="300">
<rect x="50" y="10" rx="20" ry="20" width="150" height="150" fill="red" />
<rect x="70" y="30" rx="20" ry="20" width="150" height="150" fill="orange" />
<rect x="90" y="50" rx="20" ry="20" width="150" height="150" fill="yellow" />
<rect x="110" y="70" rx="20" ry="20" width="150" height="150" fill="green" />
<rect x="130" y="90" rx="20" ry="20" width="150" height="150" fill="blue" />
<rect x="150" y="110" rx="20" ry="20" width="150" height="150" fill="indigo" />
<rect x="170" y="130" rx="20" ry="20" width="150" height="150" fill="violet" />
</svg>
</body>
</html>
""")
Out[15]:
In [16]:
HTML("""
<html>
<body>
<h3>Draw rectangle with outline</h3>
<svg width="500" height="200">
<rect width="300" height="100" fill="red" />
</svg>
</body>
</html>
""")
Out[16]:
In [17]:
HTML("""
<html>
<body>
<h3>Draw rectangle with outline</h3>
<svg width="500" height="200">
<rect width="300" height="100" fill="grey" stroke-width="5" stroke="red" />
</svg>
</body>
</html>
""")
Out[17]:
cx = x coordinate of the center of the ellipse
cy = y coordinate of the center of the ellipse
rx = horizental radius
ry = vertical radius
In [18]:
HTML("""
<html>
<body>
<h3>Draw ellipse with outline</h3>
<svg width="500" height="200">
<ellipse cx="120" cy="50" rx="120" ry="20" fill="green" />
</svg>
</body>
</html>
""")
Out[18]:
In [19]:
HTML("""
<html>
<body>
<h3>Draw red line</h3>
<svg width="500" height="200">
<line x1="0" y1="0" x2="100" y2="100" stroke-width="1" stroke="red" />
</svg>
</body>
</html>
""")
Out[19]:
In [20]:
HTML("""
<html>
<body>
<h3>Draw Text</h3>
<svg width="100" height="100">
<text x="10" y="15" fill="red">Hello World</text>
</svg>
</body>
</html>
""")
Out[20]:
In [21]:
HTML("""
<html>
<body>
<h3>Transform Text</h3>
<svg width="100" height="100">
<text x="10" y="15" fill="red" transform="rotate(30)">Hello World</text>
</svg>
</body>
</html>
""")
Out[21]: