画个心形线

# Import the module for plotting
# _*_ coding:utf-8 _*_

import numpy as np
import matplotlib.pyplot as plt

if __name__ == '__main__':
    a = 1
    t = np.linspace(-50, 50, num=1000)
    p = a * (1 - np.cos(t))
    x = p * np.sin(t)
    y = p * np.cos(t)
    plt.plot(x, y, 'r-', linewidth=0.5)
    plt.grid()
    plt.show()

你可能感兴趣的:(数学)