KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to fill the area under a curve with matplotlib. The script below works fine. import matplotlib.pyplot as plt from math import sqrt x = range(100) y = [sqrt(i) for i in x] plt.plot(x,y,color='k',lw=2) plt.fill_between(x,y,0,color='0.8') plt.show() However if I set the y-scale to logarithmic (see below). It sometimes fills the area above the curve ! Can anyone help me? I would like to fill the area between the curve and y = 0. x = range(100) y = [sqrt(i) for i in x] plt.plot(x,y,color='k',lw=2) plt.fill_between(x,y,0,color='0.8') plt.yscale('log') plt.show() Thanks in advance!
Tags (comma-separated)
Save Edits
Cancel