当我打字的时候
from sympy import *
from sympy.plotting import *
from sympy.plotting.plot import *
x, y = symbols('x y')
f = Function('f')
g = Function('g')
f = 1/((x+0.3)**2 + y**2) - 1/((x-0.3)**2 + y**2 )
g = (x+0.3)/sqrt((x+0.3)**2 + y**2) - (x-0.3)/sqrt((x-0.3)**2 + y**2)
p0 = Plot(ContourSeries(f,(x,-1.5,1.5),(y,-1.5,1.5)))
p1 = Plot(ContourSeries(g,(x,-1.5,1.5),(y,-1.5,1.5)))
p0.show()
p1.show()
p0如第一张图所示。线路数量少。在
我想画更多的线像第二幅画。在
解决办法是什么?在
ContourSeries类没有公开正确的信息来实现这一点,但它很容易扩展。我调用了参数
levels
,直接传递给matplotlib。在第1.1.1条和第3.1条至少应该适用。Sympy plotting正在为此系列使用matplotlibs countour(https://github.com/sympy/sympy/blob/master/sympy/plotting/plot.py#L909)
^{pr2}$哪个签名是
matplotlib.pyplot.contour([X, Y,] Z, [levels], **kwargs)
与matplotlib contour函数一样,可以使用固定数量的级别
或者直接过关
相关问题 更多 >
编程相关推荐