Matplotlib fill area under curve between two x values only

前端 未结 1 630
予麋鹿
予麋鹿 2021-01-07 01:55

I\'d like to fill the area under some curve between two values on the horizontal axis only. I tried

import matplotlib.pyplot as plt
import numpy as np
from s         


        
相关标签:
1条回答
  • 2021-01-07 02:28

    This error occurred because

    x > -3 and x < -2
    

    is an ambiguous numpy expression, so it raises the error. Instead you want

    (x > -3) & (x < -2)
    

    Other options are to use logical_and or bitwise_and (or even * should work).

    0 讨论(0)
提交回复
热议问题