Draw Dream House Using Python Matplotlib Module

Draw Dream House Using Python Matplotlib Module

In [1]:
import matplotlib.pyplot as plt
import numpy as np
In [2]:
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")
plt.show()

Set figure size and xaxis & y axis limit

In [3]:
plt.figure(figsize = (10, 10))

plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")


plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

Draw a rectangle like a four walls

In [4]:
plt.figure(figsize = (10, 10))

#four points
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")

#draw walls
plt.plot([2, 8, 8, 2, 2], [2, 2, 5, 5, 2])


plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

Draw a triangle on top of rectangle

In [5]:
plt.figure(figsize = (10, 10))

#four points
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")

#draw walls
plt.plot([2, 8, 8, 2, 2], [2, 2, 5, 5, 2])

#triangle points and connect them
plt.plot(5, 7,  marker = "o")
plt.plot([2, 5, 8], [5, 7, 5])

plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

Draw exhauste in triangle part

In [6]:
plt.figure(figsize = (10, 10))

#four points
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")

#draw walls
plt.plot([2, 8, 8, 2, 2], [2, 2, 5, 5, 2])

#triangle points and connect them
plt.plot(5, 7,  marker = "o")
plt.plot([2, 5, 8], [5, 7, 5])

#exhauste
plt.plot(5, 6, marker = "o", markersize = 35, color = 'green')

plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

Draw door and lock

In [7]:
plt.figure(figsize = (10, 10))

#four points
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")

#draw walls
plt.plot([2, 8, 8, 2, 2], [2, 2, 5, 5, 2])

#triangle points and connect them
plt.plot(5, 7,  marker = "o")
plt.plot([2, 5, 8], [5, 7, 5])

#exhauste
plt.plot(5, 6, marker = "o", markersize = 35, color = 'green')

#door
plt.plot(6, 4,  marker = "o")
plt.plot(7, 4,  marker = "o")
plt.plot([6, 6, 7, 7], [2, 4, 4, 2])
plt.plot([6, 7], [4, 2])
plt.plot([7, 6], [4, 2])

#lock
plt.plot(6.5, 3,  marker = "o", markersize = 15, color = 'gold')

plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

Draw window and grill on it

In [8]:
plt.figure(figsize = (10, 10))

#four points
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")

#draw walls
plt.plot([2, 8, 8, 2, 2], [2, 2, 5, 5, 2])

#triangle points and connect them
plt.plot(5, 7,  marker = "o")
plt.plot([2, 5, 8], [5, 7, 5])

#exhauste
plt.plot(5, 6, marker = "o", markersize = 35, color = 'green')

#door
plt.plot(6, 4,  marker = "o")
plt.plot(7, 4,  marker = "o")
plt.plot([6, 6, 7, 7], [2, 4, 4, 2])
plt.plot([6, 7], [4, 2])
plt.plot([7, 6], [4, 2])

#lock
plt.plot(6.5, 3,  marker = "o", markersize = 15, color = 'gold')

#window
plt.plot(2.5, 3.5, marker = 'o')
plt.plot(4, 3.5, marker = 'o')
plt.plot(4, 4.5, marker = 'o')
plt.plot(2.5, 4.5, marker = 'o')

plt.plot([2.5, 4, 4, 2.5, 2.5], [3.5, 3.5, 4.5, 4.5, 3.5])

#horizental grill in window
plt.plot([2.8, 2.8], [3.5, 4.5])
plt.plot([3.1, 3.1], [3.5, 4.5])
plt.plot([3.4, 3.4], [3.5, 4.5])
plt.plot([3.7, 3.7], [3.5, 4.5])

#verticle grill in window
plt.plot([2.5, 4], [3.8, 3.8])
plt.plot([2.5, 4], [4.2, 4.2])


plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

chimney

In [9]:
plt.figure(figsize = (10, 10))

#four points
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")

#draw walls
plt.plot([2, 8, 8, 2, 2], [2, 2, 5, 5, 2])

#triangle points and connect them
plt.plot(5, 7,  marker = "o")
plt.plot([2, 5, 8], [5, 7, 5])

#exhauste
plt.plot(5, 6, marker = "o", markersize = 35, color = 'green')

#door
plt.plot(6, 4,  marker = "o")
plt.plot(7, 4,  marker = "o")
plt.plot([6, 6, 7, 7], [2, 4, 4, 2])
plt.plot([6, 7], [4, 2])
plt.plot([7, 6], [4, 2])

#lock
plt.plot(6.5, 3,  marker = "o", markersize = 15, color = 'gold')

#window
plt.plot(2.5, 3.5, marker = 'o')
plt.plot(4, 3.5, marker = 'o')
plt.plot(4, 4.5, marker = 'o')
plt.plot(2.5, 4.5, marker = 'o')

plt.plot([2.5, 4, 4, 2.5, 2.5], [3.5, 3.5, 4.5, 4.5, 3.5])

#horizental grill in window
plt.plot([2.8, 2.8], [3.5, 4.5])
plt.plot([3.1, 3.1], [3.5, 4.5])
plt.plot([3.4, 3.4], [3.5, 4.5])
plt.plot([3.7, 3.7], [3.5, 4.5])

#verticle grill in window
plt.plot([2.5, 4], [3.8, 3.8])
plt.plot([2.5, 4], [4.2, 4.2])

#draw chimney
plt.plot(3.5, 6.1, marker = 'o')
plt.plot(3.5, 7.5, marker = 'o')
plt.plot(4, 6.4, marker = 'o')
plt.plot(4, 7.5, marker = 'o')

plt.plot([3.5, 3.5], [6.1, 7.5])
plt.plot([4, 4], [6.4, 7.5])


plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

Draw sun

In [10]:
plt.figure(figsize = (10, 10))

#four points
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")

#draw walls
plt.plot([2, 8, 8, 2, 2], [2, 2, 5, 5, 2])

#triangle points and connect them
plt.plot(5, 7,  marker = "o")
plt.plot([2, 5, 8], [5, 7, 5])

#exhauste
plt.plot(5, 6, marker = "o", markersize = 35, color = 'green')

#door
plt.plot(6, 4,  marker = "o")
plt.plot(7, 4,  marker = "o")
plt.plot([6, 6, 7, 7], [2, 4, 4, 2])
plt.plot([6, 7], [4, 2])
plt.plot([7, 6], [4, 2])

#lock
plt.plot(6.5, 3,  marker = "o", markersize = 15, color = 'gold')

#window
plt.plot(2.5, 3.5, marker = 'o')
plt.plot(4, 3.5, marker = 'o')
plt.plot(4, 4.5, marker = 'o')
plt.plot(2.5, 4.5, marker = 'o')

plt.plot([2.5, 4, 4, 2.5, 2.5], [3.5, 3.5, 4.5, 4.5, 3.5])

#horizental grill in window
plt.plot([2.8, 2.8], [3.5, 4.5])
plt.plot([3.1, 3.1], [3.5, 4.5])
plt.plot([3.4, 3.4], [3.5, 4.5])
plt.plot([3.7, 3.7], [3.5, 4.5])

#verticle grill in window
plt.plot([2.5, 4], [3.8, 3.8])
plt.plot([2.5, 4], [4.2, 4.2])

#draw chimney
plt.plot(3.5, 6.1, marker = 'o')
plt.plot(3.5, 7.5, marker = 'o')
plt.plot(4, 6.4, marker = 'o')
plt.plot(4, 7.5, marker = 'o')

plt.plot([3.5, 3.5], [6.1, 7.5])
plt.plot([4, 4], [6.4, 7.5])

#draw sun
plt.plot(9, 9, marker = 'o', markersize = 50, color='yellow')


plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

Draw fence

In [11]:
plt.figure(figsize = (10, 10))

#four points
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")

#draw walls
plt.plot([2, 8, 8, 2, 2], [2, 2, 5, 5, 2])

#triangle points and connect them
plt.plot(5, 7,  marker = "o")
plt.plot([2, 5, 8], [5, 7, 5])

#exhauste
plt.plot(5, 6, marker = "o", markersize = 35, color = 'green')

#door
plt.plot(6, 4,  marker = "o")
plt.plot(7, 4,  marker = "o")
plt.plot([6, 6, 7, 7], [2, 4, 4, 2])
plt.plot([6, 7], [4, 2])
plt.plot([7, 6], [4, 2])

#lock
plt.plot(6.5, 3,  marker = "o", markersize = 15, color = 'gold')

#window
plt.plot(2.5, 3.5, marker = 'o')
plt.plot(4, 3.5, marker = 'o')
plt.plot(4, 4.5, marker = 'o')
plt.plot(2.5, 4.5, marker = 'o')

plt.plot([2.5, 4, 4, 2.5, 2.5], [3.5, 3.5, 4.5, 4.5, 3.5])

#horizental grill in window
plt.plot([2.8, 2.8], [3.5, 4.5])
plt.plot([3.1, 3.1], [3.5, 4.5])
plt.plot([3.4, 3.4], [3.5, 4.5])
plt.plot([3.7, 3.7], [3.5, 4.5])

#verticle grill in window
plt.plot([2.5, 4], [3.8, 3.8])
plt.plot([2.5, 4], [4.2, 4.2])

#draw chimney
plt.plot(3.5, 6.1, marker = 'o')
plt.plot(3.5, 7.5, marker = 'o')
plt.plot(4, 6.4, marker = 'o')
plt.plot(4, 7.5, marker = 'o')

plt.plot([3.5, 3.5], [6.1, 7.5])
plt.plot([4, 4], [6.4, 7.5])

#draw sun
plt.plot(9, 9, marker = 'o', markersize = 50, color='yellow', markeredgecolor = 'r')

#fence
for i in np.linspace(1, 10, 20):
    plt.plot(i , 1.5, "go", alpha=0.5, marker=r'$\clubsuit$', markersize=30)
    pass

plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

Draw heart

In [12]:
plt.figure(figsize = (10, 10))

#four points
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")

#draw walls
plt.plot([2, 8, 8, 2, 2], [2, 2, 5, 5, 2])

#triangle points and connect them
plt.plot(5, 7,  marker = "o")
plt.plot([2, 5, 8], [5, 7, 5])

#exhauste
plt.plot(5, 6, marker = "o", markersize = 35, color = 'green')

#door
plt.plot(6, 4,  marker = "o")
plt.plot(7, 4,  marker = "o")
plt.plot([6, 6, 7, 7], [2, 4, 4, 2])
plt.plot([6, 7], [4, 2])
plt.plot([7, 6], [4, 2])

#lock
plt.plot(6.5, 3,  marker = "o", markersize = 15, color = 'gold')

#window
plt.plot(2.5, 3.5, marker = 'o')
plt.plot(4, 3.5, marker = 'o')
plt.plot(4, 4.5, marker = 'o')
plt.plot(2.5, 4.5, marker = 'o')

plt.plot([2.5, 4, 4, 2.5, 2.5], [3.5, 3.5, 4.5, 4.5, 3.5])

#horizental grill in window
plt.plot([2.8, 2.8], [3.5, 4.5])
plt.plot([3.1, 3.1], [3.5, 4.5])
plt.plot([3.4, 3.4], [3.5, 4.5])
plt.plot([3.7, 3.7], [3.5, 4.5])

#verticle grill in window
plt.plot([2.5, 4], [3.8, 3.8])
plt.plot([2.5, 4], [4.2, 4.2])

#draw chimney
plt.plot(3.5, 6.1, marker = 'o')
plt.plot(3.5, 7.5, marker = 'o')
plt.plot(4, 6.4, marker = 'o')
plt.plot(4, 7.5, marker = 'o')

plt.plot([3.5, 3.5], [6.1, 7.5])
plt.plot([4, 4], [6.4, 7.5])

#draw sun
plt.plot(9, 9, marker = 'o', markersize = 50, color='yellow', markeredgecolor = 'r')

#fence
for i in np.linspace(1, 10, 20):
    plt.plot(i , 1.5, "go", alpha=0.5, marker=r'$\clubsuit$', markersize=30)
    pass


#draw heart
plt.plot(8, 7, marker=r'$\heartsuit$', color='red', markersize = 80)
plt.plot(7.5, 6.5, marker="$\u2665$", color='red', markersize = 80)

plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

Change axes facecolor as black and draw stars

In [13]:
plt.rcParams['axes.facecolor']='black'
plt.figure(figsize = (10, 10))

#four points
plt.plot(2, 2,  marker = "o")
plt.plot(8, 2,  marker = "o")
plt.plot(8, 5,  marker = "o")
plt.plot(2, 5,  marker = "o")

#draw walls
plt.plot([2, 8, 8, 2, 2], [2, 2, 5, 5, 2])

#triangle points and connect them
plt.plot(5, 7,  marker = "o")
plt.plot([2, 5, 8], [5, 7, 5])

#exhauste
plt.plot(5, 6, marker = "o", markersize = 35, color = 'green')

#door
plt.plot(6, 4,  marker = "o")
plt.plot(7, 4,  marker = "o")
plt.plot([6, 6, 7, 7], [2, 4, 4, 2])
plt.plot([6, 7], [4, 2])
plt.plot([7, 6], [4, 2])

#lock
plt.plot(6.5, 3,  marker = "o", markersize = 15, color = 'gold')

#window
plt.plot(2.5, 3.5, marker = 'o')
plt.plot(4, 3.5, marker = 'o')
plt.plot(4, 4.5, marker = 'o')
plt.plot(2.5, 4.5, marker = 'o')

plt.plot([2.5, 4, 4, 2.5, 2.5], [3.5, 3.5, 4.5, 4.5, 3.5])

#horizental grill in window
plt.plot([2.8, 2.8], [3.5, 4.5])
plt.plot([3.1, 3.1], [3.5, 4.5])
plt.plot([3.4, 3.4], [3.5, 4.5])
plt.plot([3.7, 3.7], [3.5, 4.5])

#verticle grill in window
plt.plot([2.5, 4], [3.8, 3.8])
plt.plot([2.5, 4], [4.2, 4.2])

#draw chimney
plt.plot(3.5, 6.1, marker = 'o')
plt.plot(3.5, 7.5, marker = 'o')
plt.plot(4, 6.4, marker = 'o')
plt.plot(4, 7.5, marker = 'o')

plt.plot([3.5, 3.5], [6.1, 7.5])
plt.plot([4, 4], [6.4, 7.5])

#draw sun
plt.plot(9, 9, marker = 'o', markersize = 50, color='white', markeredgecolor = 'grey')

#fence
for i in np.linspace(1, 10, 20):
    plt.plot(i , 1.5, "go", alpha=0.5, marker=r'$\clubsuit$', markersize=30)
    pass


#draw heart
plt.plot(8, 7, marker=r'$\heartsuit$', color='red', markersize = 80)
plt.plot(7.5, 6.5, marker="$\u2665$", color='red', markersize = 80)

#draw stars
plt.plot(2, 9, marker = '*', markersize = 10, color='white')
plt.plot(3, 9.5, marker = '*', markersize = 5, color='white')
plt.plot(5, 9.2, marker = '*', markersize = 15, color='white')
plt.plot(3, 8, marker = '*', markersize = 10, color='white')
plt.plot(4, 9, marker = '*', markersize = 5, color='white')
plt.plot(6, 9, marker = '*', markersize = 5, color='white')
plt.plot(6, 9, marker = '*', markersize = 5, color='white')
plt.plot(7.5, 9, marker = '*', markersize = 5, color='white')
plt.plot(7, 9.4, marker = '*', markersize = 10, color='white')
plt.plot(9, 9.8, marker = '*', markersize = 5, color='white')
plt.plot(6.5, 8.3, marker = '*', markersize = 10, color='white')
plt.plot(1.2, 9.5, marker = '*', markersize = 10, color='white')
plt.plot(1.5, 8, marker = '*', markersize = 10, color='white')
plt.plot(9.5, 8.5, marker = '*', markersize = 10, color='white')

plt.xlim(1, 10)
plt.ylim(1, 10)
plt.show()

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