-
Notifications
You must be signed in to change notification settings - Fork 0
/
THIS_IS_FOR_YOU2.py
37 lines (32 loc) · 1016 Bytes
/
THIS_IS_FOR_YOU2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.textpath import TextPath
from matplotlib.patches import PathPatch
from matplotlib.font_manager import FontProperties
# 주어진 함수 정의
def f1(x):
return np.sqrt(0.25-(x-(abs(x)/x)*0.5)**2)
def f2(x):
return -((1 + x**0.2) * (1 - x**0.2))**0.4
def make_for_you():
# x 범위 설정
x = np.linspace(-1, 1, 51)
# 함수 적용하여 y 값 계산
y1 = f1(x)
y2 = f2(x)
y3 = f2(-x)
fp = FontProperties(family="DejaVu Sans")
heart_path = TextPath((0, 0), "♥", size=1, prop=fp)
scalar = 1000
# 그래프 설정
plt.figure(figsize=(8, 6))
plt.scatter(x, y1, s=scalar, color='r', marker=heart_path)
plt.scatter(x, y2, s=scalar, color='r', marker=heart_path)
plt.scatter(x, y3, s=scalar, color='r', marker=heart_path)
plt.title('THIS IS FOR YOU!!♥')
plt.grid(False)
plt.xticks([], [])
plt.yticks([], [])
plt.savefig('heart.png')
plt.show()
make_for_you()