# 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()