Matplotlib Subplot
Machine Learning courses with 100+ Real-time projects Start Now!!
Program 1
import matplotlib.pyplot as mat
x=[0,1,2,3,4,5]
y=[0,1,4,9,16,25]
x1=[10,20,30,40,50]
y1=[10,30,20,50,40]
x2=[100,200,300,400,500]
y3=[100,400,300,500,200]
mat.subplot(3,1,1)
mat.plot(x,y,marker="o",mec='k',mfc='r',ms=10,ls="solid",lw=5,c='b',label='Product1 ')
mat.plot(y1,x1,marker="o",mec='r',mfc='k',ms=10,ls="solid",lw=5,c='g',label='Product 2')
mat.xlabel("X-Product")
mat.xlabel("Y Product")
mat.title("Product")
mat.legend()
mat.subplot(3,1,2)
mat.plot(x1,y1,marker="o",mec='y',mfc='k',ms=10,ls="solid",lw=5,c='r',label='Sales')
mat.xlabel("X-Sales")
mat.xlabel("Y-Sales")
mat.title("Sales")
mat.legend()
mat.subplot(3,1,3)
mat.plot(x1,y1,marker="o",mec='y',mfc='k',ms=10,ls="solid",lw=5,c='r',label='Company')
mat.xlabel("X-Company")
mat.xlabel("Y-Company")
mat.title("Company")
mat.legend()
mat.show()
If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

