画个心形线

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013589137/article/details/79939306
# 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()

猜你喜欢

转载自blog.csdn.net/u013589137/article/details/79939306
今日推荐