Matplotlib Tutorials

Matplotlib Program for Legend Function 0

Matplotlib Program for Legend Function

Program 1 import matplotlib.pyplot as mat x=[0,1,2,3,4,5] y=[0,1,4,9,16,25] y1=[0,10,20,30,40,50] y2=[0,20,10,40,30,50] #mat.plot(x,y,x,y1) # mat.legend([‘Sales’,’Product’]) mat.plot(x,y,label=”Product”,marker=”.”,mfc=’r’,mec=’k’) mat.plot(x,y1,label=”Sales”,marker=”*”,mfc=’y’,mec=’k’) mat.plot(x,y2,label=”Company”,marker=”.”,mfc=’c’,mec=’k’) mat.legend(loc=2,facecolor=’cyan’,edgecolor=’red’,framealpha=0.5,shadow=True,fancybox=True) mat.show()  

How to Apply Grid in Graph Plot in Matplotlib 0

How to Apply Grid in Graph Plot in Matplotlib

Program 1 import matplotlib.pyplot as mat x=[0,1,2,3,4,5] y=[0,5,2,15,12,20] mat.plot(x,y,marker=’.’,mec=’r’,mfc=’k’,ms=7,ls=’solid’,lw=2,c=’y’) mat.grid(axis=’both’,ls=’solid’,lw=2,c=’g’) fc={‘family’:’Times New Roman’,’size’:20,’color’:’r’} mat.xlabel(“X-Axis”,fontdict=fc) mat.ylabel(“Y-Axis”,fontdict=fc) mat.title(“Grid Chart”,fontdict=fc) mat.show()  

How to Change Font of Title and Axis in Chart using Matplotlib 0

How to Change Font of Title and Axis in Chart using Matplotlib

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()  

3d plots in matplotlib 0

3D Plotting in Matplotlib

When it comes to data visualisation, 3D charts are crucial since they allow for the three-dimensional depiction of data. They allow us to investigate intricate connections and patterns that would otherwise be hidden in...

pie chart in matplotlib 0

Pie Charts in Matplotlib

Understanding Matplotlib Pie Charts Pie Charts: A Brief Introduction Pie charts are often used to display percentages or other relative measures of data. Categorical data may be easily understood in terms of its distribution...

histogram in matplotlib 0

Histograms in Matplotlib

Histograms are graphs that show how data is distributed. They show how often something occurs or how likely something is, helping us to see trends, high points, and outliers in continuous data. When investigating...