xticks(), yticks(), xlim(), ylim() Methods in Matplotlib

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

import matplotlib.pyplot as mat
x=[0,10,20,30,40,50]
y=[0,100,200,300,400,500]
mat.plot(x,y)
c={'family':'Times New Roman','size':20,'color':'r'}
fc1={'family':'Times New Roman','size':25,'color':'g'}

mat.xlabel("Product",fontdict=c)
mat.ylabel("Price",fontdict=fc1)
mat.title("Data Flair",fontdict=fc1)
mat.xticks(x,['A','B','C','D','E','F'])
mat.yticks(y,['50-60','10-20','20-30','30-40','40-50','50-60'])
# mat.xlim([10,100])
# mat.ylim([100,500])
mat.show()

 

 

If you are Happy with DataFlair, do not forget to make us happy with your positive feedback on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *