6.6

python函数图形2绘制

import matplotlib.pyplot as plt

import numpy as np

 

x = np.arange(-2, 2, 0.0001)

y1 = np.sqrt(2 * np.sqrt(x ** 2) - x ** 2)

y2 = (-2.14) * np.sqrt(np.sqrt(2) - np.sqrt(np.abs(x)))

plt.plot(x, y1, 'r', x, y2, 'r')

plt.fill_between(x, y1, y2, facecolor='red')

plt.savefig("heart.png")

plt.show()

posted @ 2024-06-06 22:38  catsahsy  阅读(13)  评论(0)    收藏  举报