Can you think of celebrating Valentine with Python? Hahaha... In this blog, we will create a boy and girl using the Matplotlib Python module and write some messages using the Python module...
You must know how to draw a point and multiple points at different places in Matplotlib. Also, you must know how to draw a circle and move up and down circle at required places.
In [1]:
import matplotlib.pyplot as plt
from numpy import sin, cos, linspace, pi
I am setting the figure size according to my requirements. You can decide according to your choice.
In [2]:
plt.figure(figsize = (12, 8))
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
I am drawing two hearts so that it will look like a ballon with a black outline.
In [3]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [4]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [5]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [15]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
#############boys's code starts here#####################3
#boy's face circle
boy_face_angles = linspace(0, 2 * pi, 100)
r1 = 0.65
boy_face_xs = r1 * cos(boy_face_angles)
boy_face_ys = r1 * sin(boy_face_angles) + -1
plt.plot(boy_face_xs, boy_face_ys, color = 'black')
#boy's eyes
plt.plot(0, -0.8, marker = 'o', color = 'black', markersize = 4)
plt.plot(0.4, -1, marker = 'o', color = 'black', markersize = 4)
#boy's mouth
boy_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
r2 = 0.3
boy_mouth_xs = r2 * cos(boy_mouth_angles) + 0.1
boy_mouth_ys = r2 * sin(boy_mouth_angles) + -1.1
plt.plot(boy_mouth_xs, boy_mouth_ys, color = 'black')
#############boys's code ends here #####################
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [6]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
#############boys's code starts here#####################3
#boy's face circle
boy_face_angles = linspace(0, 2 * pi, 100)
r1 = 0.65
boy_face_xs = r1 * cos(boy_face_angles)
boy_face_ys = r1 * sin(boy_face_angles) + -1
plt.plot(boy_face_xs, boy_face_ys, color = 'black')
#boy's eyes
plt.plot(0, -0.8, marker = 'o', color = 'black', markersize = 4)
plt.plot(0.4, -1, marker = 'o', color = 'black', markersize = 4)
#boy's mouth
boy_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
r2 = 0.3
boy_mouth_xs = r2 * cos(boy_mouth_angles) + 0.1
boy_mouth_ys = r2 * sin(boy_mouth_angles) + -1.1
plt.plot(boy_mouth_xs, boy_mouth_ys, color = 'black')
#boy's hairs
boy_hair_1_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r3 = 0.7
boy_hair_1_xs = r3 * cos(boy_hair_1_angles) + 0.3
boy_hair_1_ys = r3 * sin(boy_hair_1_angles) + -1.1
plt.plot(boy_hair_1_xs, boy_hair_1_ys, color = 'red')
boy_hair_2_angles = linspace(0, pi/2, 50)
r4 = 0.4
boy_hair_2_xs = r4 * cos(boy_hair_2_angles) + 0.3
boy_hair_2_ys = r4 * sin(boy_hair_2_angles) + -0.8
plt.plot(boy_hair_2_xs, boy_hair_2_ys, color = 'blue')
boy_hair_3_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r5 = 0.8
boy_hair_3_xs = r5 * cos(boy_hair_3_angles) + 0.2
boy_hair_3_ys = r5 * sin(boy_hair_3_angles) + -1.1
plt.plot(boy_hair_3_xs, boy_hair_3_ys, color = 'yellow')
#############boys's code ends here #####################
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [7]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
#############boys's code starts here#####################3
#boy's face circle
boy_face_angles = linspace(0, 2 * pi, 100)
r1 = 0.65
boy_face_xs = r1 * cos(boy_face_angles)
boy_face_ys = r1 * sin(boy_face_angles) + -1
plt.plot(boy_face_xs, boy_face_ys, color = 'black')
#boy's eyes
plt.plot(0, -0.8, marker = 'o', color = 'black', markersize = 4)
plt.plot(0.4, -1, marker = 'o', color = 'black', markersize = 4)
#boy's mouth
boy_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
r2 = 0.3
boy_mouth_xs = r2 * cos(boy_mouth_angles) + 0.1
boy_mouth_ys = r2 * sin(boy_mouth_angles) + -1.1
plt.plot(boy_mouth_xs, boy_mouth_ys, color = 'black')
#boy's hairs
boy_hair_1_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r3 = 0.7
boy_hair_1_xs = r3 * cos(boy_hair_1_angles) + 0.3
boy_hair_1_ys = r3 * sin(boy_hair_1_angles) + -1.1
plt.plot(boy_hair_1_xs, boy_hair_1_ys, color = 'red')
boy_hair_2_angles = linspace(0, pi/2, 50)
r4 = 0.4
boy_hair_2_xs = r4 * cos(boy_hair_2_angles) + 0.3
boy_hair_2_ys = r4 * sin(boy_hair_2_angles) + -0.8
plt.plot(boy_hair_2_xs, boy_hair_2_ys, color = 'blue')
boy_hair_3_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r5 = 0.8
boy_hair_3_xs = r5 * cos(boy_hair_3_angles) + 0.2
boy_hair_3_ys = r5 * sin(boy_hair_3_angles) + -1.1
plt.plot(boy_hair_3_xs, boy_hair_3_ys, color = 'yellow')
boy_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r6 = 0.3
boy_hair_4_xs = r6 * cos(boy_hair_4_angles) + 0.25
boy_hair_4_ys = r6 * sin(boy_hair_4_angles) + -0.75
plt.plot(boy_hair_4_xs, boy_hair_4_ys, color = 'green')
boy_hair_5_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r7 = 0.5
boy_hair_5_xs = r7 * cos(boy_hair_5_angles) + -0.15
boy_hair_5_ys = r7 * sin(boy_hair_5_angles) + -0.5
plt.plot(boy_hair_5_xs, boy_hair_5_ys, color = 'purple')
#############boys's code ends here #####################
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [8]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
#############boys's code starts here#####################3
#boy's face circle
boy_face_angles = linspace(0, 2 * pi, 100)
r1 = 0.65
boy_face_xs = r1 * cos(boy_face_angles)
boy_face_ys = r1 * sin(boy_face_angles) + -1
plt.plot(boy_face_xs, boy_face_ys, color = 'black')
#boy's eyes
plt.plot(0, -0.8, marker = 'o', color = 'black', markersize = 4)
plt.plot(0.4, -1, marker = 'o', color = 'black', markersize = 4)
#boy's mouth
boy_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
r2 = 0.3
boy_mouth_xs = r2 * cos(boy_mouth_angles) + 0.1
boy_mouth_ys = r2 * sin(boy_mouth_angles) + -1.1
plt.plot(boy_mouth_xs, boy_mouth_ys, color = 'black')
#boy's hairs
boy_hair_1_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r3 = 0.7
boy_hair_1_xs = r3 * cos(boy_hair_1_angles) + 0.3
boy_hair_1_ys = r3 * sin(boy_hair_1_angles) + -1.1
plt.plot(boy_hair_1_xs, boy_hair_1_ys, color = 'black')
boy_hair_2_angles = linspace(0, pi/2, 50)
r4 = 0.4
boy_hair_2_xs = r4 * cos(boy_hair_2_angles) + 0.3
boy_hair_2_ys = r4 * sin(boy_hair_2_angles) + -0.8
plt.plot(boy_hair_2_xs, boy_hair_2_ys, color = 'black')
boy_hair_3_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r5 = 0.8
boy_hair_3_xs = r5 * cos(boy_hair_3_angles) + 0.2
boy_hair_3_ys = r5 * sin(boy_hair_3_angles) + -1.16
plt.plot(boy_hair_3_xs, boy_hair_3_ys, color = 'black')
boy_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r6 = 0.3
boy_hair_4_xs = r6 * cos(boy_hair_4_angles) + 0.25
boy_hair_4_ys = r6 * sin(boy_hair_4_angles) + -0.75
plt.plot(boy_hair_4_xs, boy_hair_4_ys, color = 'black')
boy_hair_5_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r7 = 0.5
boy_hair_5_xs = r7 * cos(boy_hair_5_angles) + -0.15
boy_hair_5_ys = r7 * sin(boy_hair_5_angles) + -0.5
plt.plot(boy_hair_5_xs, boy_hair_5_ys, color = 'black')
#############boys's code ends here #####################
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [9]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
#############boys's code starts here#####################3
#boy's face circle
boy_face_angles = linspace(0, 2 * pi, 100)
r1 = 0.65
boy_face_xs = r1 * cos(boy_face_angles)
boy_face_ys = r1 * sin(boy_face_angles) + -1
plt.plot(boy_face_xs, boy_face_ys, color = 'black')
#boy's eyes
plt.plot(0, -0.8, marker = 'o', color = 'black', markersize = 4)
plt.plot(0.4, -1, marker = 'o', color = 'black', markersize = 4)
#boy's mouth
boy_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
r2 = 0.3
boy_mouth_xs = r2 * cos(boy_mouth_angles) + 0.1
boy_mouth_ys = r2 * sin(boy_mouth_angles) + -1.1
plt.plot(boy_mouth_xs, boy_mouth_ys, color = 'black')
#boy's hairs
boy_hair_1_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r3 = 0.7
boy_hair_1_xs = r3 * cos(boy_hair_1_angles) + 0.3
boy_hair_1_ys = r3 * sin(boy_hair_1_angles) + -1.1
plt.plot(boy_hair_1_xs, boy_hair_1_ys, color = 'black')
boy_hair_2_angles = linspace(0, pi/2, 50)
r4 = 0.4
boy_hair_2_xs = r4 * cos(boy_hair_2_angles) + 0.3
boy_hair_2_ys = r4 * sin(boy_hair_2_angles) + -0.8
plt.plot(boy_hair_2_xs, boy_hair_2_ys, color = 'black')
boy_hair_3_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r5 = 0.8
boy_hair_3_xs = r5 * cos(boy_hair_3_angles) + 0.2
boy_hair_3_ys = r5 * sin(boy_hair_3_angles) + -1.16
plt.plot(boy_hair_3_xs, boy_hair_3_ys, color = 'black')
boy_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r6 = 0.3
boy_hair_4_xs = r6 * cos(boy_hair_4_angles) + 0.25
boy_hair_4_ys = r6 * sin(boy_hair_4_angles) + -0.75
plt.plot(boy_hair_4_xs, boy_hair_4_ys, color = 'black')
boy_hair_5_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r7 = 0.5
boy_hair_5_xs = r7 * cos(boy_hair_5_angles) + -0.15
boy_hair_5_ys = r7 * sin(boy_hair_5_angles) + -0.5
plt.plot(boy_hair_5_xs, boy_hair_5_ys, color = 'black')
#body
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
#plt.plot(0, -2.4, marker = 'o', color = 'blue')
#plt.plot(0, -1.7, marker = 'o', color = 'green')
#plt.plot(-0.3, -1.6, marker = 'o', color = 'purple')
plt.plot(
(-0.7, 0, 0, -0.3, -0.7),
(-2.2, -2.4, -1.7, -1.6, -2.2),
color = "black"
)
#boy's pant
#plt.plot(-0.9, -2.6, marker = 'o', color = 'purple')
#plt.plot(-0.6, -2.7, marker = 'o', color = 'red')
#plt.plot(-0.48, -2.6, marker = 'o', color = 'green')
#plt.plot(-0.45, -2.75, marker = 'o', color = 'yellow')
#plt.plot(-0.1, -2.85, marker = 'o', color = 'blue')
#plt.plot(0, -2.4, marker = 'o', color = 'lightgreen')
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
plt.plot(
(-0.9, -0.6, -0.48, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = "black"
)
plt.fill(
(-0.9, -0.6, -0.5, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = '#E81C01'
)
#############boys's code ends here #####################
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [10]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
#############boys's code starts here#####################3
#boy's face circle
boy_face_angles = linspace(0, 2 * pi, 100)
r1 = 0.65
boy_face_xs = r1 * cos(boy_face_angles)
boy_face_ys = r1 * sin(boy_face_angles) + -1
plt.plot(boy_face_xs, boy_face_ys, color = 'black')
#boy's eyes
plt.plot(0, -0.8, marker = 'o', color = 'black', markersize = 4)
plt.plot(0.4, -1, marker = 'o', color = 'black', markersize = 4)
#boy's mouth
boy_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
r2 = 0.3
boy_mouth_xs = r2 * cos(boy_mouth_angles) + 0.1
boy_mouth_ys = r2 * sin(boy_mouth_angles) + -1.1
plt.plot(boy_mouth_xs, boy_mouth_ys, color = 'black')
#boy's hairs
boy_hair_1_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r3 = 0.7
boy_hair_1_xs = r3 * cos(boy_hair_1_angles) + 0.3
boy_hair_1_ys = r3 * sin(boy_hair_1_angles) + -1.1
plt.plot(boy_hair_1_xs, boy_hair_1_ys, color = 'black')
boy_hair_2_angles = linspace(0, pi/2, 50)
r4 = 0.4
boy_hair_2_xs = r4 * cos(boy_hair_2_angles) + 0.3
boy_hair_2_ys = r4 * sin(boy_hair_2_angles) + -0.8
plt.plot(boy_hair_2_xs, boy_hair_2_ys, color = 'black')
boy_hair_3_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r5 = 0.8
boy_hair_3_xs = r5 * cos(boy_hair_3_angles) + 0.2
boy_hair_3_ys = r5 * sin(boy_hair_3_angles) + -1.16
plt.plot(boy_hair_3_xs, boy_hair_3_ys, color = 'black')
boy_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r6 = 0.3
boy_hair_4_xs = r6 * cos(boy_hair_4_angles) + 0.25
boy_hair_4_ys = r6 * sin(boy_hair_4_angles) + -0.75
plt.plot(boy_hair_4_xs, boy_hair_4_ys, color = 'black')
boy_hair_5_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r7 = 0.5
boy_hair_5_xs = r7 * cos(boy_hair_5_angles) + -0.15
boy_hair_5_ys = r7 * sin(boy_hair_5_angles) + -0.5
plt.plot(boy_hair_5_xs, boy_hair_5_ys, color = 'black')
#body
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
#plt.plot(0, -2.4, marker = 'o', color = 'blue')
#plt.plot(0, -1.7, marker = 'o', color = 'green')
#plt.plot(-0.3, -1.6, marker = 'o', color = 'purple')
plt.plot(
(-0.7, 0, 0, -0.3, -0.7),
(-2.2, -2.4, -1.7, -1.6, -2.2),
color = "black"
)
#boy's pant
#plt.plot(-0.9, -2.6, marker = 'o', color = 'purple')
#plt.plot(-0.6, -2.7, marker = 'o', color = 'red')
#plt.plot(-0.48, -2.6, marker = 'o', color = 'green')
#plt.plot(-0.45, -2.75, marker = 'o', color = 'yellow')
#plt.plot(-0.1, -2.85, marker = 'o', color = 'blue')
#plt.plot(0, -2.4, marker = 'o', color = 'lightgreen')
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
plt.plot(
(-0.9, -0.6, -0.48, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = "black"
)
plt.fill(
(-0.9, -0.6, -0.5, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = '#E81C01'
)
#right legs
#plt.plot(-0.8, -2.7, marker = 'o', color = 'red')
#plt.plot(-1.2, -3.5, marker = 'o', color = 'red')
plt.plot(-1.1, -3.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(-0.8, -1.2),
(-2.7, -3.5),
color = 'black'
)
#left leg
#plt.plot(-0.3, -2.8, marker = 'o', color = 'red')
#plt.plot(-0.5, -3.60, marker = 'o', color = 'blue')
plt.plot(-0.4, -3.60, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(-0.3, -0.5),
(-2.8, -3.60),
color = 'black'
)
#############boys's code ends here #####################
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [11]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
#############boys's code starts here#####################3
#boy's face circle
boy_face_angles = linspace(0, 2 * pi, 100)
r1 = 0.65
boy_face_xs = r1 * cos(boy_face_angles)
boy_face_ys = r1 * sin(boy_face_angles) + -1
plt.plot(boy_face_xs, boy_face_ys, color = 'black')
#boy's eyes
plt.plot(0, -0.8, marker = 'o', color = 'black', markersize = 4)
plt.plot(0.4, -1, marker = 'o', color = 'black', markersize = 4)
#boy's mouth
boy_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
r2 = 0.3
boy_mouth_xs = r2 * cos(boy_mouth_angles) + 0.1
boy_mouth_ys = r2 * sin(boy_mouth_angles) + -1.1
plt.plot(boy_mouth_xs, boy_mouth_ys, color = 'black')
#boy's hairs
boy_hair_1_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r3 = 0.7
boy_hair_1_xs = r3 * cos(boy_hair_1_angles) + 0.3
boy_hair_1_ys = r3 * sin(boy_hair_1_angles) + -1.1
plt.plot(boy_hair_1_xs, boy_hair_1_ys, color = 'black')
boy_hair_2_angles = linspace(0, pi/2, 50)
r4 = 0.4
boy_hair_2_xs = r4 * cos(boy_hair_2_angles) + 0.3
boy_hair_2_ys = r4 * sin(boy_hair_2_angles) + -0.8
plt.plot(boy_hair_2_xs, boy_hair_2_ys, color = 'black')
boy_hair_3_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r5 = 0.8
boy_hair_3_xs = r5 * cos(boy_hair_3_angles) + 0.2
boy_hair_3_ys = r5 * sin(boy_hair_3_angles) + -1.16
plt.plot(boy_hair_3_xs, boy_hair_3_ys, color = 'black')
boy_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r6 = 0.3
boy_hair_4_xs = r6 * cos(boy_hair_4_angles) + 0.25
boy_hair_4_ys = r6 * sin(boy_hair_4_angles) + -0.75
plt.plot(boy_hair_4_xs, boy_hair_4_ys, color = 'black')
boy_hair_5_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r7 = 0.5
boy_hair_5_xs = r7 * cos(boy_hair_5_angles) + -0.15
boy_hair_5_ys = r7 * sin(boy_hair_5_angles) + -0.5
plt.plot(boy_hair_5_xs, boy_hair_5_ys, color = 'black')
#body
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
#plt.plot(0, -2.4, marker = 'o', color = 'blue')
#plt.plot(0, -1.7, marker = 'o', color = 'green')
#plt.plot(-0.3, -1.6, marker = 'o', color = 'purple')
plt.plot(
(-0.7, 0, 0, -0.3, -0.7),
(-2.2, -2.4, -1.7, -1.6, -2.2),
color = "black"
)
#boy's pant
#plt.plot(-0.9, -2.6, marker = 'o', color = 'purple')
#plt.plot(-0.6, -2.7, marker = 'o', color = 'red')
#plt.plot(-0.48, -2.6, marker = 'o', color = 'green')
#plt.plot(-0.45, -2.75, marker = 'o', color = 'yellow')
#plt.plot(-0.1, -2.85, marker = 'o', color = 'blue')
#plt.plot(0, -2.4, marker = 'o', color = 'lightgreen')
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
plt.plot(
(-0.9, -0.6, -0.48, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = "black"
)
plt.fill(
(-0.9, -0.6, -0.5, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = '#E81C01'
)
#right legs
#plt.plot(-0.8, -2.7, marker = 'o', color = 'red')
#plt.plot(-1.2, -3.5, marker = 'o', color = 'red')
plt.plot(-1.1, -3.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(-0.8, -1.2),
(-2.7, -3.5),
color = 'black'
)
#left leg
#plt.plot(-0.3, -2.8, marker = 'o', color = 'red')
#plt.plot(-0.5, -3.60, marker = 'o', color = 'blue')
plt.plot(-0.4, -3.60, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(-0.3, -0.5),
(-2.8, -3.60),
color = 'black'
)
#boys's left hands
#plt.plot(-0.4, -1.5, marker = 'o', color = 'blue')
#plt.plot(-1.65, -1.5, marker = 'o', color = 'green')
plt.plot(-1.5, -1.5, marker = "<", color = 'black', markersize = 12)
plt.plot(
(-0.4, -1.5),
(-1.65, -1.5),
color = 'black'
)
#boys's right hands
#plt.plot(0, -1.75, marker = 'o', color = 'blue')
#plt.plot(1.25, -2.2, marker = 'o', color = 'green')
plt.plot(1.25, -2.15, marker = ">", color = 'black', markersize = 12)
plt.plot(
(0, 1.25),
(-1.75, -2.2),
color = 'black'
)
#############boys's code ends here #####################
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [12]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
#############boys's code starts here#####################3
#boy's face circle
boy_face_angles = linspace(0, 2 * pi, 100)
r1 = 0.65
boy_face_xs = r1 * cos(boy_face_angles)
boy_face_ys = r1 * sin(boy_face_angles) + -1
plt.plot(boy_face_xs, boy_face_ys, color = 'black')
#boy's eyes
plt.plot(0, -0.8, marker = 'o', color = 'black', markersize = 4)
plt.plot(0.4, -1, marker = 'o', color = 'black', markersize = 4)
#boy's mouth
boy_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
r2 = 0.3
boy_mouth_xs = r2 * cos(boy_mouth_angles) + 0.1
boy_mouth_ys = r2 * sin(boy_mouth_angles) + -1.1
plt.plot(boy_mouth_xs, boy_mouth_ys, color = 'black')
#boy's hairs
boy_hair_1_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r3 = 0.7
boy_hair_1_xs = r3 * cos(boy_hair_1_angles) + 0.3
boy_hair_1_ys = r3 * sin(boy_hair_1_angles) + -1.1
plt.plot(boy_hair_1_xs, boy_hair_1_ys, color = 'black')
boy_hair_2_angles = linspace(0, pi/2, 50)
r4 = 0.4
boy_hair_2_xs = r4 * cos(boy_hair_2_angles) + 0.3
boy_hair_2_ys = r4 * sin(boy_hair_2_angles) + -0.8
plt.plot(boy_hair_2_xs, boy_hair_2_ys, color = 'black')
boy_hair_3_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r5 = 0.8
boy_hair_3_xs = r5 * cos(boy_hair_3_angles) + 0.2
boy_hair_3_ys = r5 * sin(boy_hair_3_angles) + -1.16
plt.plot(boy_hair_3_xs, boy_hair_3_ys, color = 'black')
boy_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r6 = 0.3
boy_hair_4_xs = r6 * cos(boy_hair_4_angles) + 0.25
boy_hair_4_ys = r6 * sin(boy_hair_4_angles) + -0.75
plt.plot(boy_hair_4_xs, boy_hair_4_ys, color = 'black')
boy_hair_5_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r7 = 0.5
boy_hair_5_xs = r7 * cos(boy_hair_5_angles) + -0.15
boy_hair_5_ys = r7 * sin(boy_hair_5_angles) + -0.5
plt.plot(boy_hair_5_xs, boy_hair_5_ys, color = 'black')
#body
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
#plt.plot(0, -2.4, marker = 'o', color = 'blue')
#plt.plot(0, -1.7, marker = 'o', color = 'green')
#plt.plot(-0.3, -1.6, marker = 'o', color = 'purple')
plt.plot(
(-0.7, 0, 0, -0.3, -0.7),
(-2.2, -2.4, -1.7, -1.6, -2.2),
color = "black"
)
#boy's pant
#plt.plot(-0.9, -2.6, marker = 'o', color = 'purple')
#plt.plot(-0.6, -2.7, marker = 'o', color = 'red')
#plt.plot(-0.48, -2.6, marker = 'o', color = 'green')
#plt.plot(-0.45, -2.75, marker = 'o', color = 'yellow')
#plt.plot(-0.1, -2.85, marker = 'o', color = 'blue')
#plt.plot(0, -2.4, marker = 'o', color = 'lightgreen')
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
plt.plot(
(-0.9, -0.6, -0.48, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = "black"
)
plt.fill(
(-0.9, -0.6, -0.5, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = '#E81C01'
)
#right legs
#plt.plot(-0.8, -2.7, marker = 'o', color = 'red')
#plt.plot(-1.2, -3.5, marker = 'o', color = 'red')
plt.plot(-1.1, -3.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(-0.8, -1.2),
(-2.7, -3.5),
color = 'black'
)
#left leg
#plt.plot(-0.3, -2.8, marker = 'o', color = 'red')
#plt.plot(-0.5, -3.60, marker = 'o', color = 'blue')
plt.plot(-0.4, -3.60, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(-0.3, -0.5),
(-2.8, -3.60),
color = 'black'
)
#boys's left hands
#plt.plot(-0.4, -1.5, marker = 'o', color = 'blue')
#plt.plot(-1.65, -1.5, marker = 'o', color = 'green')
plt.plot(-1.5, -1.5, marker = "<", color = 'black', markersize = 12)
plt.plot(
(-0.4, -1.5),
(-1.65, -1.5),
color = 'black'
)
#boys's right hands
#plt.plot(0, -1.75, marker = 'o', color = 'blue')
#plt.plot(1.25, -2.2, marker = 'o', color = 'green')
plt.plot(1.25, -2.15, marker = ">", color = 'black', markersize = 12)
plt.plot(
(0, 1.25),
(-1.75, -2.2),
color = 'black'
)
#############boys's code ends here #####################
############ girl's code starts here ################
#girl's face circle
girl_face_angles = linspace(0, 2 * pi, 100)
#r1 = 0.65
girl_face_xs = r1 * cos(girl_face_angles) + 3
girl_face_ys = r1 * sin(girl_face_angles) + -1.8
plt.plot(girl_face_xs, girl_face_ys, color = 'black')
#girl's eyes
plt.plot(2.65, -1.55, marker = 'o', color = 'black', markersize = 4)
plt.plot(3.1, -1.75, marker = 'o', color = 'black', markersize = 4)
#girl's mouth
girl_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
#r2 = 0.3
girl_mouth_xs = r2 * cos(girl_mouth_angles) + 2.85
girl_mouth_ys = r2 * sin(girl_mouth_angles) + -1.8
plt.plot(girl_mouth_xs, girl_mouth_ys, color = 'black')
#girl's body
#plt.plot(2.6, -3.6, marker = 'o', color = 'purple', markersize = 4)
#plt.plot(3.9, -3.6, marker = 'o', color = 'yellow', markersize = 4)
#plt.plot(3.3, -2.4, marker = 'o', color = 'red', markersize = 4)
#plt.plot(2.9, -2.5, marker = 'o', color = 'green', markersize = 4)
plt.plot(
(2.6, 3.9, 3.3, 2.9, 2.6),
(-3.6, -3.6, -2.4, -2.5, -3.6),
color = "black"
)
plt.fill(
(2.6, 3.9, 3.3, 2.9, 2.6),
(-3.6, -3.6, -2.4, -2.5, -3.6),
color = "#E81C01"
)
#girl's right hand
#plt.plot(2.9, -2.6, marker = 'o', color = 'blue')
#plt.plot(1.7, -2.4, marker = 'o', color = 'green')
plt.plot(1.65, -2.4, marker = "<", color = 'black', markersize = 12)
plt.plot(
(2.9, 1.7),
(-2.6, -2.4),
color = 'black'
)
#girl's left hand
#plt.plot(3.4, -2.6, marker = 'o', color = 'blue')
#plt.plot(4.6, -2.9, marker = 'o', color = 'green')
plt.plot(4.5, -2.85, marker = ">", color = 'black', markersize = 12)
plt.plot(
(3.4, 4.6),
(-2.6, -2.9),
color = 'black'
)
#girl's left legs
#plt.plot(3, -3.6, marker = 'o', color = 'purple')
#plt.plot(2.7, -4.5, marker = 'o', color = 'red')
plt.plot(2.6, -4.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(3, 2.7),
(-3.6, -4.5),
color = 'black'
)
#girl's left legs
#plt.plot(3.4, -3.6, marker = 'o', color = 'purple')
#plt.plot(3.6, -4.5, marker = 'o', color = 'red')
plt.plot(3.5, -4.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(3.4, 3.6),
(-3.6, -4.5),
color = 'black'
)
#girl's hair
girl_hair_1_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r8 = 0.55
girl_hair_1_xs = r8 * cos(girl_hair_1_angles) + 2.9
girl_hair_1_ys = r8 * sin(girl_hair_1_angles) + -1.6
plt.plot(girl_hair_1_xs, girl_hair_1_ys, color = 'black')
girl_hair_2_angles = linspace(7/8 * 2 * pi, 11/8 * 2 * pi, 50)
r9 = 0.35
girl_hair_2_xs = r9 * cos(girl_hair_2_angles) + 2.9
girl_hair_2_ys = r9 * sin(girl_hair_2_angles) + -1.4
plt.plot(girl_hair_2_xs, girl_hair_2_ys, color = 'black')
girl_hair_3_angles = linspace(7/8 * 2 * pi, 12/8 * 2 * pi, 50)
r10 = 0.6
girl_hair_3_xs = r10 * cos(girl_hair_3_angles) + 3
girl_hair_3_ys = r10 * sin(girl_hair_3_angles) + -1.7
plt.plot(girl_hair_3_xs, girl_hair_3_ys, color = 'black')
girl_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r11 = 0.3
girl_hair_4_xs = r11 * cos(girl_hair_4_angles) + 3.1
girl_hair_4_ys = r11 * sin(girl_hair_4_angles) + -1.45
plt.plot(girl_hair_4_xs, girl_hair_4_ys, color = 'black')
############ girl's code ends here ################
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [13]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
#############boys's code starts here#####################3
#boy's face circle
boy_face_angles = linspace(0, 2 * pi, 100)
r1 = 0.65
boy_face_xs = r1 * cos(boy_face_angles)
boy_face_ys = r1 * sin(boy_face_angles) + -1
plt.plot(boy_face_xs, boy_face_ys, color = 'black')
#boy's eyes
plt.plot(0, -0.8, marker = 'o', color = 'black', markersize = 4)
plt.plot(0.4, -1, marker = 'o', color = 'black', markersize = 4)
#boy's mouth
boy_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
r2 = 0.3
boy_mouth_xs = r2 * cos(boy_mouth_angles) + 0.1
boy_mouth_ys = r2 * sin(boy_mouth_angles) + -1.1
plt.plot(boy_mouth_xs, boy_mouth_ys, color = 'black')
#boy's hairs
boy_hair_1_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r3 = 0.7
boy_hair_1_xs = r3 * cos(boy_hair_1_angles) + 0.3
boy_hair_1_ys = r3 * sin(boy_hair_1_angles) + -1.1
plt.plot(boy_hair_1_xs, boy_hair_1_ys, color = 'black')
boy_hair_2_angles = linspace(0, pi/2, 50)
r4 = 0.4
boy_hair_2_xs = r4 * cos(boy_hair_2_angles) + 0.3
boy_hair_2_ys = r4 * sin(boy_hair_2_angles) + -0.8
plt.plot(boy_hair_2_xs, boy_hair_2_ys, color = 'black')
boy_hair_3_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r5 = 0.8
boy_hair_3_xs = r5 * cos(boy_hair_3_angles) + 0.2
boy_hair_3_ys = r5 * sin(boy_hair_3_angles) + -1.16
plt.plot(boy_hair_3_xs, boy_hair_3_ys, color = 'black')
boy_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r6 = 0.3
boy_hair_4_xs = r6 * cos(boy_hair_4_angles) + 0.25
boy_hair_4_ys = r6 * sin(boy_hair_4_angles) + -0.75
plt.plot(boy_hair_4_xs, boy_hair_4_ys, color = 'black')
boy_hair_5_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r7 = 0.5
boy_hair_5_xs = r7 * cos(boy_hair_5_angles) + -0.15
boy_hair_5_ys = r7 * sin(boy_hair_5_angles) + -0.5
plt.plot(boy_hair_5_xs, boy_hair_5_ys, color = 'black')
#body
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
#plt.plot(0, -2.4, marker = 'o', color = 'blue')
#plt.plot(0, -1.7, marker = 'o', color = 'green')
#plt.plot(-0.3, -1.6, marker = 'o', color = 'purple')
plt.plot(
(-0.7, 0, 0, -0.3, -0.7),
(-2.2, -2.4, -1.7, -1.6, -2.2),
color = "black"
)
#boy's pant
#plt.plot(-0.9, -2.6, marker = 'o', color = 'purple')
#plt.plot(-0.6, -2.7, marker = 'o', color = 'red')
#plt.plot(-0.48, -2.6, marker = 'o', color = 'green')
#plt.plot(-0.45, -2.75, marker = 'o', color = 'yellow')
#plt.plot(-0.1, -2.85, marker = 'o', color = 'blue')
#plt.plot(0, -2.4, marker = 'o', color = 'lightgreen')
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
plt.plot(
(-0.9, -0.6, -0.48, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = "black"
)
plt.fill(
(-0.9, -0.6, -0.5, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = '#E81C01'
)
#right legs
#plt.plot(-0.8, -2.7, marker = 'o', color = 'red')
#plt.plot(-1.2, -3.5, marker = 'o', color = 'red')
plt.plot(-1.1, -3.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(-0.8, -1.2),
(-2.7, -3.5),
color = 'black'
)
#left leg
#plt.plot(-0.3, -2.8, marker = 'o', color = 'red')
#plt.plot(-0.5, -3.60, marker = 'o', color = 'blue')
plt.plot(-0.4, -3.60, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(-0.3, -0.5),
(-2.8, -3.60),
color = 'black'
)
#boys's left hands
#plt.plot(-0.4, -1.5, marker = 'o', color = 'blue')
#plt.plot(-1.65, -1.5, marker = 'o', color = 'green')
plt.plot(-1.5, -1.5, marker = "<", color = 'black', markersize = 12)
plt.plot(
(-0.4, -1.5),
(-1.65, -1.5),
color = 'black'
)
#boys's right hands
#plt.plot(0, -1.75, marker = 'o', color = 'blue')
#plt.plot(1.25, -2.2, marker = 'o', color = 'green')
plt.plot(1.25, -2.15, marker = ">", color = 'black', markersize = 12)
plt.plot(
(0, 1.25),
(-1.75, -2.2),
color = 'black'
)
#############boys's code ends here #####################
############ girl's code starts here ################
#girl's face circle
girl_face_angles = linspace(0, 2 * pi, 100)
#r1 = 0.65
girl_face_xs = r1 * cos(girl_face_angles) + 3
girl_face_ys = r1 * sin(girl_face_angles) + -1.8
plt.plot(girl_face_xs, girl_face_ys, color = 'black')
#girl's eyes
plt.plot(2.65, -1.55, marker = 'o', color = 'black', markersize = 4)
plt.plot(3.1, -1.75, marker = 'o', color = 'black', markersize = 4)
#girl's mouth
girl_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
#r2 = 0.3
girl_mouth_xs = r2 * cos(girl_mouth_angles) + 2.85
girl_mouth_ys = r2 * sin(girl_mouth_angles) + -1.8
plt.plot(girl_mouth_xs, girl_mouth_ys, color = 'black')
#girl's body
#plt.plot(2.6, -3.6, marker = 'o', color = 'purple', markersize = 4)
#plt.plot(3.9, -3.6, marker = 'o', color = 'yellow', markersize = 4)
#plt.plot(3.3, -2.4, marker = 'o', color = 'red', markersize = 4)
#plt.plot(2.9, -2.5, marker = 'o', color = 'green', markersize = 4)
plt.plot(
(2.6, 3.9, 3.3, 2.9, 2.6),
(-3.6, -3.6, -2.4, -2.5, -3.6),
color = "black"
)
plt.fill(
(2.6, 3.9, 3.3, 2.9, 2.6),
(-3.6, -3.6, -2.4, -2.5, -3.6),
color = "#E81C01"
)
#girl's right hand
#plt.plot(2.9, -2.6, marker = 'o', color = 'blue')
#plt.plot(1.7, -2.4, marker = 'o', color = 'green')
plt.plot(1.65, -2.4, marker = "<", color = 'black', markersize = 12)
plt.plot(
(2.9, 1.7),
(-2.6, -2.4),
color = 'black'
)
#girl's left hand
#plt.plot(3.4, -2.6, marker = 'o', color = 'blue')
#plt.plot(4.6, -2.9, marker = 'o', color = 'green')
plt.plot(4.5, -2.85, marker = ">", color = 'black', markersize = 12)
plt.plot(
(3.4, 4.6),
(-2.6, -2.9),
color = 'black'
)
#girl's left legs
#plt.plot(3, -3.6, marker = 'o', color = 'purple')
#plt.plot(2.7, -4.5, marker = 'o', color = 'red')
plt.plot(2.6, -4.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(3, 2.7),
(-3.6, -4.5),
color = 'black'
)
#girl's left legs
#plt.plot(3.4, -3.6, marker = 'o', color = 'purple')
#plt.plot(3.6, -4.5, marker = 'o', color = 'red')
plt.plot(3.5, -4.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(3.4, 3.6),
(-3.6, -4.5),
color = 'black'
)
#girl's hair
girl_hair_1_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r8 = 0.55
girl_hair_1_xs = r8 * cos(girl_hair_1_angles) + 2.9
girl_hair_1_ys = r8 * sin(girl_hair_1_angles) + -1.6
plt.plot(girl_hair_1_xs, girl_hair_1_ys, color = 'black')
girl_hair_2_angles = linspace(7/8 * 2 * pi, 11/8 * 2 * pi, 50)
r9 = 0.35
girl_hair_2_xs = r9 * cos(girl_hair_2_angles) + 2.9
girl_hair_2_ys = r9 * sin(girl_hair_2_angles) + -1.4
plt.plot(girl_hair_2_xs, girl_hair_2_ys, color = 'black')
girl_hair_3_angles = linspace(7/8 * 2 * pi, 12/8 * 2 * pi, 50)
r10 = 0.6
girl_hair_3_xs = r10 * cos(girl_hair_3_angles) + 3
girl_hair_3_ys = r10 * sin(girl_hair_3_angles) + -1.7
plt.plot(girl_hair_3_xs, girl_hair_3_ys, color = 'black')
girl_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r11 = 0.3
girl_hair_4_xs = r11 * cos(girl_hair_4_angles) + 3.1
girl_hair_4_ys = r11 * sin(girl_hair_4_angles) + -1.45
plt.plot(girl_hair_4_xs, girl_hair_4_ys, color = 'black')
############ girl's code ends here ################
########### messages starts here #################
plt.text(0.3, 4, r'Ek tera saath', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 3.5, r'Humko do jahan se pyaara hain', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 3, r'Tu hain to har sahara hain', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 2.5, r'Na mile sansar,', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 2, r'Tera pyar toh humara hain', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 1.5, r'Tu hain to har sahara hain', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 1, r'Ek tera saath', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 0.5, r'Humko do jahan se pyaara hain', fontsize=12, fontfamily = 'serif')
plt.text(-3.2, 2.7, r'Whenever I feel like giving up,', fontsize=10, color = 'white', fontfamily = 'serif')
plt.text(-3, 2.2, r'your love keeps me going.', fontsize=10, color = 'white', fontfamily = 'serif')
########### messages ends here #################
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.show()
In [14]:
plt.figure(figsize = (12, 8))
#big heart ballon
plt.plot(-1.8, 2, marker="$\u2665$", color='black', markersize = 184)
plt.plot(-1.8, 2, marker="$\u2665$", color='#E81C01', markersize = 180)
#small triangle on the heart
#plt.plot(-1.85, -0.2, marker = 'o', color = 'blue')
#plt.plot(-1.35, -0.2, marker = 'o', color = 'green')
#plt.plot(-1.6, 0.1, marker = 'o', color = 'yellow')
plt.plot(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
lw = 1,
color = 'black'
)
plt.fill(
(-1.85, -1.35, -1.6, -1.85),
(-0.2, -0.2, 0.1, -0.2),
color = '#E81C01'
)
#thread
#plt.plot(-1.6, -0.2, marker = 'o', color = 'black')
#plt.plot(-1.6, -4, marker = 'o', color = 'green')
plt.plot(
(-1.6, -1.6),
(-0.2, -1.5),
color = "black"
)
plt.plot(
(-1.4, -1.4),
(-1.5, -2.5),
color = "black"
)
#############boys's code starts here#####################3
#boy's face circle
boy_face_angles = linspace(0, 2 * pi, 100)
r1 = 0.65
boy_face_xs = r1 * cos(boy_face_angles)
boy_face_ys = r1 * sin(boy_face_angles) + -1
plt.plot(boy_face_xs, boy_face_ys, color = 'black')
#boy's eyes
plt.plot(0, -0.8, marker = 'o', color = 'black', markersize = 4)
plt.plot(0.4, -1, marker = 'o', color = 'black', markersize = 4)
#boy's mouth
boy_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
r2 = 0.3
boy_mouth_xs = r2 * cos(boy_mouth_angles) + 0.1
boy_mouth_ys = r2 * sin(boy_mouth_angles) + -1.1
plt.plot(boy_mouth_xs, boy_mouth_ys, color = 'black')
#boy's hairs
boy_hair_1_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r3 = 0.7
boy_hair_1_xs = r3 * cos(boy_hair_1_angles) + 0.3
boy_hair_1_ys = r3 * sin(boy_hair_1_angles) + -1.1
plt.plot(boy_hair_1_xs, boy_hair_1_ys, color = 'black')
boy_hair_2_angles = linspace(0, pi/2, 50)
r4 = 0.4
boy_hair_2_xs = r4 * cos(boy_hair_2_angles) + 0.3
boy_hair_2_ys = r4 * sin(boy_hair_2_angles) + -0.8
plt.plot(boy_hair_2_xs, boy_hair_2_ys, color = 'black')
boy_hair_3_angles = linspace(2/8 * 2 * pi, 3/8 * 2 * pi, 50)
r5 = 0.8
boy_hair_3_xs = r5 * cos(boy_hair_3_angles) + 0.2
boy_hair_3_ys = r5 * sin(boy_hair_3_angles) + -1.16
plt.plot(boy_hair_3_xs, boy_hair_3_ys, color = 'black')
boy_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r6 = 0.3
boy_hair_4_xs = r6 * cos(boy_hair_4_angles) + 0.25
boy_hair_4_ys = r6 * sin(boy_hair_4_angles) + -0.75
plt.plot(boy_hair_4_xs, boy_hair_4_ys, color = 'black')
boy_hair_5_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r7 = 0.5
boy_hair_5_xs = r7 * cos(boy_hair_5_angles) + -0.15
boy_hair_5_ys = r7 * sin(boy_hair_5_angles) + -0.5
plt.plot(boy_hair_5_xs, boy_hair_5_ys, color = 'black')
#body
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
#plt.plot(0, -2.4, marker = 'o', color = 'blue')
#plt.plot(0, -1.7, marker = 'o', color = 'green')
#plt.plot(-0.3, -1.6, marker = 'o', color = 'purple')
plt.plot(
(-0.7, 0, 0, -0.3, -0.7),
(-2.2, -2.4, -1.7, -1.6, -2.2),
color = "black"
)
#boy's pant
#plt.plot(-0.9, -2.6, marker = 'o', color = 'purple')
#plt.plot(-0.6, -2.7, marker = 'o', color = 'red')
#plt.plot(-0.48, -2.6, marker = 'o', color = 'green')
#plt.plot(-0.45, -2.75, marker = 'o', color = 'yellow')
#plt.plot(-0.1, -2.85, marker = 'o', color = 'blue')
#plt.plot(0, -2.4, marker = 'o', color = 'lightgreen')
#plt.plot(-0.7, -2.2, marker = 'o', color = 'red')
plt.plot(
(-0.9, -0.6, -0.48, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = "black"
)
plt.fill(
(-0.9, -0.6, -0.5, -0.45, -0.1, 0, -0.7, -0.9),
(-2.6, -2.7, -2.6, -2.75, -2.85, -2.4, -2.2, -2.6),
color = '#E81C01'
)
#right legs
#plt.plot(-0.8, -2.7, marker = 'o', color = 'red')
#plt.plot(-1.2, -3.5, marker = 'o', color = 'red')
plt.plot(-1.1, -3.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(-0.8, -1.2),
(-2.7, -3.5),
color = 'black'
)
#left leg
#plt.plot(-0.3, -2.8, marker = 'o', color = 'red')
#plt.plot(-0.5, -3.60, marker = 'o', color = 'blue')
plt.plot(-0.4, -3.60, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(-0.3, -0.5),
(-2.8, -3.60),
color = 'black'
)
#boys's left hands
#plt.plot(-0.4, -1.5, marker = 'o', color = 'blue')
#plt.plot(-1.65, -1.5, marker = 'o', color = 'green')
plt.plot(-1.5, -1.5, marker = "<", color = 'black', markersize = 12)
plt.plot(
(-0.4, -1.5),
(-1.65, -1.5),
color = 'black'
)
#boys's right hands
#plt.plot(0, -1.75, marker = 'o', color = 'blue')
#plt.plot(1.25, -2.2, marker = 'o', color = 'green')
plt.plot(1.25, -2.15, marker = ">", color = 'black', markersize = 12)
plt.plot(
(0, 1.25),
(-1.75, -2.2),
color = 'black'
)
#############boys's code ends here #####################
############ girl's code starts here ################
#girl's face circle
girl_face_angles = linspace(0, 2 * pi, 100)
#r1 = 0.65
girl_face_xs = r1 * cos(girl_face_angles) + 3
girl_face_ys = r1 * sin(girl_face_angles) + -1.8
plt.plot(girl_face_xs, girl_face_ys, color = 'black')
#girl's eyes
plt.plot(2.65, -1.55, marker = 'o', color = 'black', markersize = 4)
plt.plot(3.1, -1.75, marker = 'o', color = 'black', markersize = 4)
#girl's mouth
girl_mouth_angles = linspace(4/8 * 2 * pi, 7/8 * 2 * pi, 50)
#r2 = 0.3
girl_mouth_xs = r2 * cos(girl_mouth_angles) + 2.85
girl_mouth_ys = r2 * sin(girl_mouth_angles) + -1.8
plt.plot(girl_mouth_xs, girl_mouth_ys, color = 'black')
#girl's body
#plt.plot(2.6, -3.6, marker = 'o', color = 'purple', markersize = 4)
#plt.plot(3.9, -3.6, marker = 'o', color = 'yellow', markersize = 4)
#plt.plot(3.3, -2.4, marker = 'o', color = 'red', markersize = 4)
#plt.plot(2.9, -2.5, marker = 'o', color = 'green', markersize = 4)
plt.plot(
(2.6, 3.9, 3.3, 2.9, 2.6),
(-3.6, -3.6, -2.4, -2.5, -3.6),
color = "black"
)
plt.fill(
(2.6, 3.9, 3.3, 2.9, 2.6),
(-3.6, -3.6, -2.4, -2.5, -3.6),
color = "#E81C01"
)
#girl's right hand
#plt.plot(2.9, -2.6, marker = 'o', color = 'blue')
#plt.plot(1.7, -2.4, marker = 'o', color = 'green')
plt.plot(1.65, -2.4, marker = "<", color = 'black', markersize = 12)
plt.plot(
(2.9, 1.7),
(-2.6, -2.4),
color = 'black'
)
#girl's left hand
#plt.plot(3.4, -2.6, marker = 'o', color = 'blue')
#plt.plot(4.6, -2.9, marker = 'o', color = 'green')
plt.plot(4.5, -2.85, marker = ">", color = 'black', markersize = 12)
plt.plot(
(3.4, 4.6),
(-2.6, -2.9),
color = 'black'
)
#girl's left legs
#plt.plot(3, -3.6, marker = 'o', color = 'purple')
#plt.plot(2.7, -4.5, marker = 'o', color = 'red')
plt.plot(2.6, -4.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(3, 2.7),
(-3.6, -4.5),
color = 'black'
)
#girl's left legs
#plt.plot(3.4, -3.6, marker = 'o', color = 'purple')
#plt.plot(3.6, -4.5, marker = 'o', color = 'red')
plt.plot(3.5, -4.5, marker = 'o', color = 'black', lw = 2, markersize = 10)
plt.plot(
(3.4, 3.6),
(-3.6, -4.5),
color = 'black'
)
#girl's hair
girl_hair_1_angles = linspace(7/8 * 2 * pi, 9/8 * 2 * pi, 50)
r8 = 0.55
girl_hair_1_xs = r8 * cos(girl_hair_1_angles) + 2.9
girl_hair_1_ys = r8 * sin(girl_hair_1_angles) + -1.6
plt.plot(girl_hair_1_xs, girl_hair_1_ys, color = 'black')
girl_hair_2_angles = linspace(7/8 * 2 * pi, 11/8 * 2 * pi, 50)
r9 = 0.35
girl_hair_2_xs = r9 * cos(girl_hair_2_angles) + 2.9
girl_hair_2_ys = r9 * sin(girl_hair_2_angles) + -1.4
plt.plot(girl_hair_2_xs, girl_hair_2_ys, color = 'black')
girl_hair_3_angles = linspace(7/8 * 2 * pi, 12/8 * 2 * pi, 50)
r10 = 0.6
girl_hair_3_xs = r10 * cos(girl_hair_3_angles) + 3
girl_hair_3_ys = r10 * sin(girl_hair_3_angles) + -1.7
plt.plot(girl_hair_3_xs, girl_hair_3_ys, color = 'black')
girl_hair_4_angles = linspace(2/8 * 2 * pi, 4/8 * 2 * pi, 50)
r11 = 0.3
girl_hair_4_xs = r11 * cos(girl_hair_4_angles) + 3.1
girl_hair_4_ys = r11 * sin(girl_hair_4_angles) + -1.45
plt.plot(girl_hair_4_xs, girl_hair_4_ys, color = 'black')
############ girl's code ends here ################
########### messages starts here #################
plt.text(0.3, 4, r'Ek tera saath', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 3.5, r'Humko do jahan se pyaara hain', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 3, r'Tu hain to har sahara hain', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 2.5, r'Na mile sansar,', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 2, r'Tera pyar toh humara hain', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 1.5, r'Tu hain to har sahara hain', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 1, r'Ek tera saath', fontsize=12, fontfamily = 'serif')
plt.text(0.3, 0.5, r'Humko do jahan se pyaara hain', fontsize=12, fontfamily = 'serif')
plt.text(-3.2, 2.7, r'Whenever I feel like giving up,', fontsize=10, color = 'white', fontfamily = 'serif')
plt.text(-3, 2.2, r'your love keeps me going.', fontsize=10, color = 'white', fontfamily = 'serif')
########### messages ends here #################
plt.xlim(-5, 5)
plt.ylim(-5, 5)
plt.gca().set_aspect('equal')
plt.axis('off')
plt.show()
In [ ]: