Plotting multiple y-values versus x using Matplotlib

Question:

I am trying to plot y1,y2,y3 all as a function of x and show all the three on a single plot. But it is showing only two plots. I present the current output.

import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(-1,0,10)
print(x)
y1=36.554+5.418*np.exp(-1.327*x) 
y2=23.816+18.088*np.exp(-0.812*x)
y3=20.562+21.389*np.exp(-0.765*x)
print(y1,y2,y3)
plt.plot(x,y1,y2,y3)

The current output is

Output

Asked By: user20032724

||

Answers:

Try this:

plt.plot(x, y1, x, y2, x, y3)
Answered By: Scaro974
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.