How to Change Font of Title and Axis in Chart using 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="solid",lw=2,c='r')

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

 

You give me 15 seconds I promise you best tutorials
Please share your happy experience on Google

courses

TechVidvan Team

TechVidvan Team provides high-quality content & courses on AI, ML, Data Science, Data Engineering, Data Analytics, programming, Python, DSA, Android, Flutter, full stack web dev, MERN, and many latest technology.

Leave a Reply

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