使用sympy plot时如何显示一个窗口?

2024-04-26 17:56:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个关于plot_implicitwindows的问题。你知道吗

当我键入以下内容时:

from sympy import *
from sympy.plotting import *

r1, r2 = symbols('r1 r2')
f = Function('f')
f = 1/r1 - 1/r2

p0=plot_implicit(Eq(f,1),(r1,-1,1),(r2,-1,1))
p1=plot_implicit(Eq(f,2),(r1,-1,1),(r2,-1,1))
p0.extend(p1)
p0.show()

打开3个窗口。(p0 graphp1 graphp0&p1 graph

我只想用两个函数来显示图形。你知道吗

我怎样才能解决这个问题?你知道吗


Tags: fromimport键入plotplottinggrapheqr2
1条回答
网友
1楼 · 发布于 2024-04-26 17:56:26

使用show=Falseplot_implicit只会出现最后一个图形:

from sympy import *
from sympy.plotting import *

r1, r2 = symbols('r1 r2')
f = Function('f')
f = 1/r1 - 1/r2

p0=plot_implicit(Eq(f,1),(r1,-1,1),(r2,-1,1), show=False)
p1=plot_implicit(Eq(f,2),(r1,-1,1),(r2,-1,1), show=False)
p0.extend(p1)
p0.show()

相关问题 更多 >