Line plot
Line plot
import matplotlib.pyplot as plt
x= [1,4,7,9]
y= [0,5,10,15]
plt.plot(x,y)
plt.show()
import matplotlib.pyplot as plt
x= [1,4,7,9]
y= [0,5,10,15]
plt.plot(x,y,linewidth = 3.0,color = " maroon ",marker = "X")
plt.show()
import numpy as np
import matplotlib.pyplot as plt
x= [10,20,30,50,60]
y =[20,40,60,80,100]
fig =plt.figure(figsize=(5,2))
plt. plot(x,y,linewidth = 1.0,linestyle = '-' , color = "red",alpha= 1.0,marker= "o")
plt. legend(["line"],loc = "best")
plt. grid(True)
plt.xlabel("x axis ")
plt.ylabel("y axis")
plt. show()
Adding two line chart 
import matplotlib.pyplot as plt
x= [1,4,7,9]
y= [0,5,10,15]
x1 = [10,20,30,40]
y1 = [0,10,20,30]
a = plt.subplot(2,2,1)
a.plot(x,y,linewidth = 0.5,marker = 'o')
b= plt.subplot(2,2,2)
b.plot(x1,y1,color = "red",linestyle = "--")
a. grid(True)
b. grid(True)
a. legend([" "])
b. legend(" ")
plt.show()
 
   
   
   
   
Comments
Post a Comment
If you have any doubts, please let me know