画星形线

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013589137/article/details/79938980
# 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(-5, 5, num=1000)
    x = a * np.power(np.cos(t), 3)
    y = a * np.power(np.sin(t), 3)
    plt.plot(x, y, 'r-', linewidth=0.5)
    plt.savefig('星形线.jpg')
    plt.grid()
    plt.show()

猜你喜欢

转载自blog.csdn.net/u013589137/article/details/79938980