-4

I have a line and a function and I need to color between they. How can I do it?

Mi Tavares
  • 161
  • 1
  • 1
  • 5
  • 3
    Your 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 Answers1

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()

enter image description here

cheersmate
  • 2,385
  • 4
  • 19
  • 32