0% found this document useful (0 votes)
28 views8 pages

Matplotlib Part 3

Setting lines, changing colors, and adding markers are some of the features of matplotlib. Different styles of lines can also be used to plot. Special plots can also be drawn using Matplotlib. Here is the highlight on these topics. To learn more about online data science courses or artificial intelligence and machine learning courses visit:http://bit.ly/DatascienceCourse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views8 pages

Matplotlib Part 3

Setting lines, changing colors, and adding markers are some of the features of matplotlib. Different styles of lines can also be used to plot. Special plots can also be drawn using Matplotlib. Here is the highlight on these topics. To learn more about online data science courses or artificial intelligence and machine learning courses visit:http://bit.ly/DatascienceCourse
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

MATPLOTLIB

( PART 3 )
SPECIAL PLOTS IN
MATPLOTLIB
Scatter Plot
 Eg:
n = 256
X = np.random.normal(0,1,n)
Y = np.random.normal(0,1,n)
plt.scatter(X,Y)
 O/P:
 Usually we do not use matplotlib for the
special plots as it has some limitations.Hence
we go for a higher version of tool that is
Seaborn.
 Still we can plot various plots at basic level in
matplotlib as well.Some of the plots that can be
plotted are:
 Scatter plot
 Histogram
 Box-plot
 Bar plot
Eg 2:
 arr1 = np.arange(1,10,0.5)
arr2 = np.log(arr1)
plt.scatter(arr1,arr2)
 O/P:
Histogram
 arr1 = np.arange(1,10,0.5)
arr2 = np.log(arr1)
plt.hist(arr1, arr2)
 O/P:
Box-Plot
 bplt = plt.boxplot(arr1, vert = True,patch_artist 
= True)
patch, color = list(zip(bplt['boxes'],['pink']))[0]
patch.set_facecolor(color)
 O/P:
Pie Chart
 Z = np.random.uniform(0, 1, 20)
plt.pie(Z)
 O/P:

 These are some of ways of plotting different graphs in Matplotlib . Due to the facilities of Seaborn
over Matplotlib, seaborn id always preferred.

You might also like