2024-04-26 03:26:23 发布
网友
我正在使用下面的代码来创建一个窦的极图。
import numpy as np import matplotlib.pyplot as plt theta = np.arange(0, 2*np.pi, .01)[1:] plt.polar(theta, sin(theta)) plt.show()
产生:
但我想把它画成对称的,像这样:
我怎样才能得到我想要的结果?
matplotlib极轴允许负半径。所以,如果你想要对称的图,你需要绘制sin的绝对值:
polar(theta, abs(sin(theta)))
另外,您需要绘制与sin(theta)相反的图:
sin(theta)
plt.polar(theta, sin(theta)) plt.polar(theta, -sin(theta))
matplotlib极轴允许负半径。所以,如果你想要对称的图,你需要绘制sin的绝对值:
另外,您需要绘制与
sin(theta)
相反的图:相关问题 更多 >
编程相关推荐