I have a line and a function and I need to color between they. How can I do it?
Asked
Active
Viewed 127 times
-4
-
3Your question has no code, no data, no attempt. Yet I would try to help and give hints given you are a new contributor. [Here](https://stackoverflow.com/questions/16417496/matplotlib-fill-between-multiple-lines), [here](https://stackoverflow.com/questions/47104547/how-to-fill-area-under-step-curve-using-pyplot) and [here](https://matplotlib.org/api/_as_gen/matplotlib.pyplot.fill_between.html) are some links which will help you to solve your problem. – Sheldore Sep 10 '18 at 19:26
1 Answers
0
You can use plt.fill_between
and specify an upper and a lower bound, e.g.:
x = np.arange(100)
plt.figure()
plt.fill_between(x, 2*x, np.sin(x))
plt.show()

cheersmate
- 2,385
- 4
- 19
- 32