我想使用 python sympy plot_implicit 在同一个图中绘制不同的方程。
下面是我的示例代码,但这不能正常工作。现在隐函数只是圆,但我想在不久的将来处理更复杂的方程。
此外,我也想在同一个图中绘制坐标点(在示例代码中作为“点”给出)。
谁能解这个方程?
import math
import numpy as np
import matplotlib.pyplot as plt
from sympy import *
from sympy.plotting import plot
from sympy.plotting import plot_implicit
points = np.array([[10,20], [20, 75], [45, 15], [70, 53], [90, 30]])
weights = np.array([5, 5.1, 5.2, 4.9, 4.8])
x, y = symbols("x y")
for i in range(len(points)):
G = (x-points[i][0])**2 + (y-points[i][1])**2 - weights[i]**2
p2 = plot_implicit(G, (x,-50,100), (y,-50,100), show=False, line_color='r')
p2.extend(p2)
p2.show()
相关分类