如何绘制(1 + x)(1 + y)> = 20?

1-a*_*ion 1 python matplotlib

在python中,我想绘制这个区域.

(1+x)*(1+y) >= 20
Run Code Online (Sandbox Code Playgroud)

我不知道怎么做matplotlib.我在互联网上搜索并找到了fillplots包但我不明白如何将它用于两个变量.

这是fillplots中的一个示例:

from fillplots import plot_regions
plotter = plot_regions([
    [(lambda x: x ** 2,),  # x ^ 2 > 0 and
     (lambda x: x + 5,)],  # x + 5 > 0
])
Run Code Online (Sandbox Code Playgroud)

小智 5

我没有足够的声誉来发表评论.我喜欢Severin的情节,但数学不对.如果y为-1,那么语句的计算结果为0且不能> = 20.左下象限(和右上)是否应该是阴影,而不是中间?我认为这与负*负相关以及方程如何转换有关.

编辑:我试着编辑上一个答案.我认为这接近于要求的内容.垂直线是边界(实际上没有阴影),可以使用此处的技术进行编辑.

from fillplots import plot_regions

plotter = plot_regions([

    # positive y+1 values (require positive x+1)
    # plotted in blue in this image
    [(lambda x: 20.0/(1.0+x) - 1.0,),        # False (default) means y > equation
     (-1,)                                   # and y > -1
    ],

    # y < -1 returns a negative value for (y+1) and requires
    # (x+1) to also have a negative value
    # plotted in green in this image
    [(lambda x: 20.0/(1.0+x) - 1.0, True),   # True means y < equation 
     (-1, True)                              # and y < -1
    ],

], xlim=(-40,40), ylim=(-40, 40))

plt.show()
Run Code Online (Sandbox Code Playgroud)

fillplots积极和消极的填充