SVG Shapes

SVG Shapes

In [1]:
from IPython.display import HTML
In [2]:
HTML("""hello
    """)
Out[2]:
hello

Headline

In [3]:
HTML("""
    <html>
        <body>
            <h1>Draw Circle</h1>
        </body>
    </html>
""")
Out[3]:

Draw Circle

Define the width and height of the SVG image

In [4]:
HTML("""
    <html>
        <body>
            <h1>Draw Circle</h1>
            <svg width="100" height="100">
                
            </svg>
        </body>
    </html>
""")
Out[4]:

Draw Circle

Draw circle

The cx and cy attributes define the x and y coordinates of the center of the circle.

If cx and cy are not set, the circle's center is set to (0, 0)

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]:

Draw Circle

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]:

Draw more bigger circle

Draw outline of circle

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]:

Draw circle with outline

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]:

Draw circle with outline

Draw square

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]:

Draw square

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]:

Draw square with x and y position

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]:

Draw square with x, y position and border

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]:

Draw square with x, y position and border

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]:

Draw square with x, y position and round border

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]:

Draw multiple squares

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]:

Draw squares

Draw rectangle

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]:

Draw rectangle with outline

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]:

Draw rectangle with outline

Draw Ellipse

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]:

Draw ellipse with outline

Draw lines

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]:

Draw red line

Draw Text

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]:

Draw Text

Hello World
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]:

Transform Text

Hello World

Machine Learning

  1. Deal Banking Marketing Campaign Dataset With Machine Learning

TensorFlow

  1. Difference Between Scalar, Vector, Matrix and Tensor
  2. TensorFlow Deep Learning Model With IRIS Dataset
  3. Sequence to Sequence Learning With Neural Networks To Perform Number Addition
  4. Image Classification Model MobileNet V2 from TensorFlow Hub
  5. Step by Step Intent Recognition With BERT
  6. Sentiment Analysis for Hotel Reviews With NLTK and Keras
  7. Simple Sequence Prediction With LSTM
  8. Image Classification With ResNet50 Model
  9. Predict Amazon Inc Stock Price with Machine Learning
  10. Predict Diabetes With Machine Learning Algorithms
  11. TensorFlow Build Custom Convolutional Neural Network With MNIST Dataset
  12. Deal Banking Marketing Campaign Dataset With Machine Learning

PySpark

  1. How to Parallelize and Distribute Collection in PySpark
  2. Role of StringIndexer and Pipelines in PySpark ML Feature - Part 1
  3. Role of OneHotEncoder and Pipelines in PySpark ML Feature - Part 2
  4. Feature Transformer VectorAssembler in PySpark ML Feature - Part 3
  5. Logistic Regression in PySpark (ML Feature) with Breast Cancer Data Set

PyTorch

  1. Build the Neural Network with PyTorch
  2. Image Classification with PyTorch
  3. Twitter Sentiment Classification In PyTorch
  4. Training an Image Classifier in Pytorch

Natural Language Processing

  1. Spelling Correction Of The Text Data In Natural Language Processing
  2. Handling Text For Machine Learning
  3. Extracting Text From PDF File in Python Using PyPDF2
  4. How to Collect Data Using Twitter API V2 For Natural Language Processing
  5. Converting Text to Features in Natural Language Processing
  6. Extract A Noun Phrase For A Sentence In Natural Language Processing