画心 画心形

import matplotlib.pyplot as plt
from matplotlib import animation
import numpy as np
import math

print(math.pi)
def drawHeart():
    t = np.linspace(0, 3, 100000)
    x = np.sin(t)
    y = np.cos(t) + np.power(x, 0.5)
    plt.plot(x, y, color='red', linewidth=10)
    plt.plot(-x, y, color='red', linewidth=10)
    # plt.xlabel('t')
    # plt.ylabel('h')
    plt.ylim(-2, 2)
    plt.xlim(-2, 2)

    plt.legend()
    plt.show()


drawHeart()

 

posted @ 2020-10-10 20:18    阅读(76)  评论(0编辑  收藏  举报