# 愛心線的方程的表達為:x** 2+ y** 2 + a * x= a * sqrt(x** 2+y** 2) 和 x** 2+ y** 2 - a * x= a * sqrt(x** 2+y** 2)
# 軟體設計的“萬能層”:x=a*(2*cos(t)-cos(2*t)) y=a*(2*sin(t)-sin(2*t))
import numpy as np
import matplotlib.pyplot as plt
'''
#x,y兩個表達式
a = 1
t = np.linspace(0, 2 * np.pi, 1024)
x = a * (2 * np.cos(t) - np.cos(2 * t))
y = a * (2 * np.sin(t) - np.sin(2 * t))
plt.plot(y, x, color='r')
plt.show() '''
# 極坐标r=a(1-sinθ)
a = 1
T = np.linspace(0, 2 * np.pi, 1024)
plt.axes(polar=True)
# for a in range(1, 5):
# plt.plot(T, a*(1.-np.sin(T)), color='r')
plt.plot(T, a*(1.-np.sin(T)), color='r')
plt.axis('off') # 去掉坐标軸
plt.show()
'''
# 受傷的心 y=a*|x|-b*sqrt(64-x^2) a越小越胖,b越大上下越胖
x = np.linspace(-8, 8, 1024)
y1 = 0.6 * np.abs(x) - 0.8 * np.sqrt(64 - x ** 2)
y2 = 0.6 * np.abs(x) + 0.8 * np.sqrt(64 - x ** 2)
plt.plot(x, y1, color='r', alpha=0)
plt.plot(x, y2, color='r', alpha=0)
# facecolr填充的顔色,alpha透明度,label标簽
plt.fill(x, y1, facecolor='r', alpha=0.5, label='y1')
plt.fill(x, y2, facecolor='r', alpha=0.5, label='y2')
plt.axis('off') # 去掉坐标軸
# plt.xticks([]) # 去掉x軸刻度
# plt.yticks([]) # 去掉Y軸刻度
plt.show()'''