How to Change Font of Title in Matplotlib

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=[i**2 for i in x]
mat.plot(x,y,marker='.',mfc='y',mec='k',ms=10,ls="dotted",lw=2,c='r')

fc={'family':'Times New Roman','size':20,'color':'r'}

fc1={'family':'Times New Roman','size':25,'color':'g'}
fc2={'family':'Verdana','size':30,'color':'b'}
mat.xlabel("X-Axis",fontdict=fc)
mat.ylabel("Y-Axis",fontdict=fc)
mat.title("Line Chart",fontdict=fc2)
mat.show()

 

Did you like our efforts? If Yes, please give DataFlair 5 Stars on Google

courses
Image

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 *