Matplotlib Fill Area Under Curve Between Two X Values Only
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 scipy.stats import norm
Solution 1:
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).
Post a Comment for "Matplotlib Fill Area Under Curve Between Two X Values Only"