SlideShare a Scribd company logo
Sanjivani Rural Education Society's
Sanjivani College of Engineering, Kopargaon 423603.
-Department of Strucutral Engineering-
By
Mr. Sumit S. Kolapkar (Assistant Professor)
Mail Id- kolapkarsumitst@sanjivani.org.in
Ø Why data visualization in Python-
• Is a quick and easy way to convey the concepts in a
universal manner.
Ø What is data visualization-
• Is a graphical way of representing information and
data.
Ø Types of data visualization in Python-
• Plotting Libraries-
• Matplotlib-
• Pandas Visualization-
• Seaborn-
• ggplot-
• Plotly-
Ø What is Matplotlib-
• Is a plotting library for Python and it is numerical
mathematical extension of Numpy
• Is 2D and 3D plotting Python library
• It was introduced by John Hunter in the year 2002
Ø Matplotlib graphs-
Ø Importing Matplotlib in Python-
• import matplotlib.pyplot as plt
OR
• from matplotlib import pyplot as plt
Example-
import matplotlib.pyplot as plt
x=[1,2,3,4,5]
y=[6,7,8,9,10]
plt.plot(x,y)
plt.show ()
Example-
import matplotlib.pyplot as plt
x=[1,2,3,4,5]
y=[6,7,8,9,10]
plt.bar(x,y)
plt.show ()
Ø Importing Matplotlib in Python-
Example-
import matplotlib.pyplot as plt
x=[1,2,3,4,5]
y=[6,7,8,9,10]
Z=['b','g','r','black','pink']
plt.bar(x,y,color=Z)
plt.show ()
Base Color-
Ø Importing Matplotlib in Python-
Ø Matplotlib Bar Plot-
• import matplotlib.pyplot as plt
x = ['Python','C','C++', 'Java']
y = [90,65,82,85]
plt.bar(x,y)
plt.show ()
Ø Matplotlib Bar Plot-
• import matplotlib.pyplot as plt
x=[ ]
y=[ ]
z=[ ]
plt.bar(x,y, width=0.4, color=“y”, align= “edge” (or center),
edgecolor=“r”, linewidth=10, linestyle=“:”, alpha=0.4,
label=“Popularity”)
plt.bar(x,z, width=0.4, color=“g”, align=edge, edgecolor=“r”,
linewidth=10, linestyle=“:”, alpha=0.4, label=“Popularity1”)...for
multiple bar graphs
plt.legend()
plt.show( )
plt.xlabel (“languages”, fontsize=10)
plt.ylabel(“No.” ”, font size=10)
plt.title(“Graph1” ”, font size=10)
Note- To apply the label we must apply for legend.
Ø Matplotlib Bar Plot-
• import matplotlib.pyplot as plt
x=[ ]
y=[ ]
z=[ ]
plt.bar(x,y, width=0.4, color=“y”,label=“Popularity”)
plt.bar(x,z, width=0.4, color=“g”, label=“Popularity1”)...for
multiple bar graphs.....overlapped
plt.legend()
plt.show( )
plt.xlabel (“languages”, fontsize=10)
plt.ylabel(“No.” ”, font size=10)
plt.title(“Graph1” ”, font size=10)
Note- To apply the label we must apply for legend.
Ø Matplotlib Bar Plot- Side by Side Graph
• import matplotlib.pyplot as plt
• import numpy as np
x=[ “python”, “c”, “c++”, “java”]
y=[80,70,60,82 ]
z=[ 20,30,40,50]
p = [0,1,2,3].....indexing of x
OR
p = np.arange(len(x))...by importing numpy also we can create an array of indexing
width = 0.4
plt.bar(p,y, width, color=“y”,label=“Popularity”)....x replaced with ‘p’
plt.bar(p,z, width, color=“g”, label=“Popularity1”)....x replaced with ‘p’
plt.legend()
plt.show( )
plt.xlabel (“languages”, fontsize=10)
plt.ylabel(“No.” ”, font size=10)
plt.title(“Graph1” ”, font size=10)
Note- To apply the label we must apply for legend.
gives number
at x-axis and
is over lapped
Ø Matplotlib Bar Plot- Side by Side Graph
• import matplotlib.pyplot as plt
• import numpy as np
x=[ “python”, “c”, “c++”, “java”]
y=[80,70,60,82 ]
z=[ 20,30,40,50]
width = 0.4
p = np.arange(len(x))
p1=[ j+width for j in p]...will create another graph of same width on side
plt.bar(p,y, width, color=“y”,label=“Popularity”)....x replaced with ‘p’
plt.bar(p1,z, width, color=“g”, label=“Popularity1”)....x replaced with ‘p’
plt.legend()
plt.show( )
plt.xlabel (“languages”, fontsize=10)
plt.ylabel(“No.” ”, font size=10)
plt.title(“Graph1” ”, font size=10)
Note- To apply the label we must apply for legend.
gives number
at x-axis
Ø Matplotlib Bar Plot- Side by Side Graph
• import matplotlib.pyplot as plt
• import numpy as np
x=[ “python”, “c”, “c++”, “java”]
y=[80,70,60,82 ]
z=[ 20,30,40,50]
width = 0.4
p = np.arange(len(x))
p1=[ j+width for j in p]...will create another graph of same width on side
plt.bar(p,y, width, color=“y”,label=“Popularity”)....x replaced with ‘p’
plt.bar(p1,z, width, color=“g”, label=“Popularity1”)....x replaced with ‘p’
plt.xticks(p+width,x)......to show name at x-axisand at right hand side
plt.legend()
plt.show( )
plt.xlabel (“languages”, fontsize=10)
plt.ylabel(“No.” ”, font size=10)
plt.title(“Graph1” ”, font size=10)
Note- To apply the label we must apply for legend.
gives name at
RHS
Ø Matplotlib Bar Plot- Side by Side Graph
• import matplotlib.pyplot as plt
• import numpy as np
x=[ “python”, “c”, “c++”, “java”]
y=[80,70,60,82 ]
z=[ 20,30,40,50]
width = 0.4
p = np.arange(len(x))
p1=[ j+width for j in p]...will create another graph of same width on side
plt.bar(p,y, width, color=“y”,label=“Popularity”)....x replaced with ‘p’
plt.bar(p1,z, width, color=“g”, label=“Popularity1”)....x replaced with ‘p’
plt.xticks(p+width/2,x,rotation=10)......to show name at x-axis and at
center
plt.legend()
plt.show( )
plt.xlabel (“languages”, fontsize=10)
plt.ylabel(“No.” ”, font size=10)
plt.title(“Graph1” ”, font size=10)
Note- To apply the label we must apply for legend.
gives name in
rotation
Ø Matplotlib Bar Plot- Horizontal Graph
• import matplotlib.pyplot as plt
• import numpy as np
• x=['Python','C','C++', 'Java']
• y=[90,65,82,85]
• z=[23,52,29,20]
• width = 0.8
• p=np.arange(len(x))
• p1=[j+width for j in p]
• plt.barh(p,y, width, color='r')
• plt.bar(p1,z, width, color='k')
• plt.xticks(p+width/2,x,rotation=50)
• plt.show ()
Ø Matplotlib Step Plot-
• import matplotlib.pyplot as plt
x=[ ]
y=[ ]
plt.step(x,y,marker= “o”, color= “r”, ms=10, mfc=
“g”)
plt.legend()
plt.grid()
plt.show( )
plt.xlabel (“languages”, font size=10)
plt.ylabel(“No.” ”, font size=10)
plt.title(“Graph1” ”, font size=10)
Note-To align the bars on the right edge pass a negative
width and align='edge'
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• plt.pie(x)
• plt.show ()
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• plt.pie(x,labels=y)
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z)
• plt.show ()
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• var1=["r","c","g","orange"]
• plt.pie(x,labels=y,explode=z,colors=var1)
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• var1=["r","c","g","orange"]
• plt.pie(x,labels=y,explode=z,colors=var1,autopct="%0.
1f%%")
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• var1=["r","c","g","orange"]
• plt.pie(x,labels=y,explode=z,colors=var1,autopct="%0.
3f%%")
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",shad
ow=True)
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",radiu
s=1.5)
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",label
distance=1.3)
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",start
angle=90)
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",textp
rops={"fontsize":15})
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",textp
rops={"fontsize":15},counterclock=False)
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",shad
ow=True,textprops={"fontsize":15},wedgeprops={"line
width":5})
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",shad
ow=True,textprops={"fontsize":15},wedgeprops={"line
width":5,"edgecolor":"c"})
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",shad
ow=True,textprops={"fontsize":15},wedgeprops={"line
width":5},rotatelabels=True)
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",radiu
s=0.9,shadow=True,textprops={"fontsize":15},wedgep
rops={"linewidth":5},rotatelabels=True)
• plt.title("Computers and Structures")
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",radiu
s=0.9,shadow=True,textprops={"fontsize":15},wedgep
rops={"linewidth":5},rotatelabels=True)
• plt.title("Computers and Structures")
• plt.legend(loc=1).....loc=1 to 10
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• x1=[40,30,20,10]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,radius=1.5)
• plt.pie(x1,radius=1)
• plt.show ()
Ø Matplotlib Pie Plot-
• import matplotlib.pyplot as plt
• x=[1,2,3,4]
• x1=[40,30,20,10]
• y=["C","C++","Java","Python"]
• z=[0.4,0.0,0.0,0.0]
• plt.pie(x,labels=y,radius=1.5)
• plt.pie([1],colors="w",radius=1)
• plt.show ()
Ø Matplotlib Save Figure-
• import matplotlib.pyplot as plt
x=[ ]
y=[ ]
plt.plot(x,y)
plt.savefig(“fname”, dpi=1000, facecolor= “g”,
transparent=True)
plt.savefig(fname.pdf)......save in format as per
requirement
plt.show( )
Ex-
import matplotlib.pyplot as plt
x=[1,2,3,4,5]
y=[90,65,82,85,80]
plt.plot(x,y)
plt.savefig("line")
plt.show()
Note- File gets saved in a folder location
Ø Matplotlib Work With Axes-
• import matplotlib.pyplot as plt
• x=[1,2,3,4,5]
• y=[3,2,1,3,4]
• plt.plot(x,y)
• plt.xticks(x)
• plt.yticks(x)
• plt.show ()
Ø Matplotlib Work With Axes-
• import matplotlib.pyplot as plt
• x=[1,2,3,4,5]
• y=[3,2,1,3,4]
• plt.plot(x,y)
• plt.xticks(x,labels=["Python","Java","C","C++","HTML"])
• plt.yticks(x)
• plt.show ()
Ø Matplotlib Work With Axes-
• import matplotlib.pyplot as plt
• x=[1,2,3,4,5]
• y=[3,2,1,3,4]
• plt.plot(x,y)
• plt.xlim(0,10)
• plt.show ()
Ø Matplotlib Work With Axes-
• import matplotlib.pyplot as plt
• x=[1,2,3,4,5]
• y=[3,2,1,3,4]
• plt.plot(x,y)
• plt.axis([0,10,0,7])
• plt.show ()
Ø Text in Matplotlib-
text- Add text at an arbitrary location of the axes.
annotate- Add an annotation with an optional arrow at an
arbitrary location of the axes
xlabel- Add a label to the axes’s along x-axis
ylabel- Add a label to the axes’s along y-axis
title- Add a title to the axes
Ø Text in Matplotlib-
Ex-
import matplotlib.pyplot as plt
x=[1,2,3,4,5]
y=[3,2,1,3,4]
plt.plot(x,y)
plt.text(2,3,"java",style="italic",bbox={"facecolor":"c"})
plt.annotate("python",xy=(2,1),xytext=(4,4),arrowprops=dict(facec
olor="green"))
plt.legend(["up"],loc=9,facecolor="red",edgecolor="c",framealpha
=0.5,shadow=True)
plt.show ()
text position on x and y
axis
THANK YOU....
Ad

More Related Content

What's hot (20)

Fuzzy image processing- fuzzy C-mean clustering
Fuzzy image processing- fuzzy C-mean clusteringFuzzy image processing- fuzzy C-mean clustering
Fuzzy image processing- fuzzy C-mean clustering
Farah M. Altufaili
 
What is TensorFlow? | Introduction to TensorFlow | TensorFlow Tutorial For Be...
What is TensorFlow? | Introduction to TensorFlow | TensorFlow Tutorial For Be...What is TensorFlow? | Introduction to TensorFlow | TensorFlow Tutorial For Be...
What is TensorFlow? | Introduction to TensorFlow | TensorFlow Tutorial For Be...
Simplilearn
 
Neural Networks: Radial Bases Functions (RBF)
Neural Networks: Radial Bases Functions (RBF)Neural Networks: Radial Bases Functions (RBF)
Neural Networks: Radial Bases Functions (RBF)
Mostafa G. M. Mostafa
 
Neural Networks: Support Vector machines
Neural Networks: Support Vector machinesNeural Networks: Support Vector machines
Neural Networks: Support Vector machines
Mostafa G. M. Mostafa
 
Handwritten digits recognition report
Handwritten digits recognition reportHandwritten digits recognition report
Handwritten digits recognition report
Swayamdipta Saha
 
Summer Training Project.pdf
Summer Training Project.pdfSummer Training Project.pdf
Summer Training Project.pdf
Lovely professinal university
 
Siamese networks
Siamese networksSiamese networks
Siamese networks
Nicholas McClure
 
Machine learning seminar ppt
Machine learning seminar pptMachine learning seminar ppt
Machine learning seminar ppt
RAHUL DANGWAL
 
Deep Learning for Recommender Systems RecSys2017 Tutorial
Deep Learning for Recommender Systems RecSys2017 Tutorial Deep Learning for Recommender Systems RecSys2017 Tutorial
Deep Learning for Recommender Systems RecSys2017 Tutorial
Alexandros Karatzoglou
 
Introduction to Recommendation Systems
Introduction to Recommendation SystemsIntroduction to Recommendation Systems
Introduction to Recommendation Systems
Trieu Nguyen
 
Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its Applications
Abhijeet Singh
 
DS LAB MANUAL.pdf
DS LAB MANUAL.pdfDS LAB MANUAL.pdf
DS LAB MANUAL.pdf
Builders Engineering College
 
Jupyter machine learning crash course
Jupyter machine learning crash courseJupyter machine learning crash course
Jupyter machine learning crash course
Olga Scrivner
 
file pointers & manipulators.pptx
file pointers & manipulators.pptxfile pointers & manipulators.pptx
file pointers & manipulators.pptx
MEGULRAJS
 
RDM 2020: Python, Numpy, and Pandas
RDM 2020: Python, Numpy, and PandasRDM 2020: Python, Numpy, and Pandas
RDM 2020: Python, Numpy, and Pandas
Henry Schreiner
 
Data Analysis in Python-NumPy
Data Analysis in Python-NumPyData Analysis in Python-NumPy
Data Analysis in Python-NumPy
Devashish Kumar
 
TensorFlow and Keras: An Overview
TensorFlow and Keras: An OverviewTensorFlow and Keras: An Overview
TensorFlow and Keras: An Overview
Poo Kuan Hoong
 
Deep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural NetworksDeep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural Networks
Christian Perone
 
Tutorial on Deep Learning
Tutorial on Deep LearningTutorial on Deep Learning
Tutorial on Deep Learning
inside-BigData.com
 
Optimal binary search tree dynamic programming
Optimal binary search tree   dynamic programmingOptimal binary search tree   dynamic programming
Optimal binary search tree dynamic programming
P. Subathra Kishore, KAMARAJ College of Engineering and Technology, Madurai
 
Fuzzy image processing- fuzzy C-mean clustering
Fuzzy image processing- fuzzy C-mean clusteringFuzzy image processing- fuzzy C-mean clustering
Fuzzy image processing- fuzzy C-mean clustering
Farah M. Altufaili
 
What is TensorFlow? | Introduction to TensorFlow | TensorFlow Tutorial For Be...
What is TensorFlow? | Introduction to TensorFlow | TensorFlow Tutorial For Be...What is TensorFlow? | Introduction to TensorFlow | TensorFlow Tutorial For Be...
What is TensorFlow? | Introduction to TensorFlow | TensorFlow Tutorial For Be...
Simplilearn
 
Neural Networks: Radial Bases Functions (RBF)
Neural Networks: Radial Bases Functions (RBF)Neural Networks: Radial Bases Functions (RBF)
Neural Networks: Radial Bases Functions (RBF)
Mostafa G. M. Mostafa
 
Neural Networks: Support Vector machines
Neural Networks: Support Vector machinesNeural Networks: Support Vector machines
Neural Networks: Support Vector machines
Mostafa G. M. Mostafa
 
Handwritten digits recognition report
Handwritten digits recognition reportHandwritten digits recognition report
Handwritten digits recognition report
Swayamdipta Saha
 
Machine learning seminar ppt
Machine learning seminar pptMachine learning seminar ppt
Machine learning seminar ppt
RAHUL DANGWAL
 
Deep Learning for Recommender Systems RecSys2017 Tutorial
Deep Learning for Recommender Systems RecSys2017 Tutorial Deep Learning for Recommender Systems RecSys2017 Tutorial
Deep Learning for Recommender Systems RecSys2017 Tutorial
Alexandros Karatzoglou
 
Introduction to Recommendation Systems
Introduction to Recommendation SystemsIntroduction to Recommendation Systems
Introduction to Recommendation Systems
Trieu Nguyen
 
Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its Applications
Abhijeet Singh
 
Jupyter machine learning crash course
Jupyter machine learning crash courseJupyter machine learning crash course
Jupyter machine learning crash course
Olga Scrivner
 
file pointers & manipulators.pptx
file pointers & manipulators.pptxfile pointers & manipulators.pptx
file pointers & manipulators.pptx
MEGULRAJS
 
RDM 2020: Python, Numpy, and Pandas
RDM 2020: Python, Numpy, and PandasRDM 2020: Python, Numpy, and Pandas
RDM 2020: Python, Numpy, and Pandas
Henry Schreiner
 
Data Analysis in Python-NumPy
Data Analysis in Python-NumPyData Analysis in Python-NumPy
Data Analysis in Python-NumPy
Devashish Kumar
 
TensorFlow and Keras: An Overview
TensorFlow and Keras: An OverviewTensorFlow and Keras: An Overview
TensorFlow and Keras: An Overview
Poo Kuan Hoong
 
Deep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural NetworksDeep Learning - Convolutional Neural Networks
Deep Learning - Convolutional Neural Networks
Christian Perone
 

Similar to Introduction to Data Visualization,Matplotlib.pdf (20)

Py lecture5 python plots
Py lecture5 python plotsPy lecture5 python plots
Py lecture5 python plots
Yoshiki Satotani
 
Python chart plotting using Matplotlib.pptx
Python chart plotting using Matplotlib.pptxPython chart plotting using Matplotlib.pptx
Python chart plotting using Matplotlib.pptx
sonali sonavane
 
matplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvf
matplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvfmatplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvf
matplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvf
zmulani8
 
Matplotlib yayyyyyyyyyyyyyin Python.pptx
Matplotlib yayyyyyyyyyyyyyin Python.pptxMatplotlib yayyyyyyyyyyyyyin Python.pptx
Matplotlib yayyyyyyyyyyyyyin Python.pptx
AamnaRaza1
 
Python Visualization API Primersubplots
Python Visualization  API PrimersubplotsPython Visualization  API Primersubplots
Python Visualization API Primersubplots
VidhyaB10
 
BASIC OF PYTHON MATPLOTLIB USED IN ARTIFICIAL INTELLIGENCE AND ML
BASIC OF PYTHON MATPLOTLIB USED IN ARTIFICIAL INTELLIGENCE AND MLBASIC OF PYTHON MATPLOTLIB USED IN ARTIFICIAL INTELLIGENCE AND ML
BASIC OF PYTHON MATPLOTLIB USED IN ARTIFICIAL INTELLIGENCE AND ML
AbhaysinhVansadia
 
Unit3-v1-Plotting and Visualization.pptx
Unit3-v1-Plotting and Visualization.pptxUnit3-v1-Plotting and Visualization.pptx
Unit3-v1-Plotting and Visualization.pptx
yerrasaniayyapparedd
 
UNit-III. part 2.pdf
UNit-III. part 2.pdfUNit-III. part 2.pdf
UNit-III. part 2.pdf
MastiCreation
 
MatplotLib.pptx
MatplotLib.pptxMatplotLib.pptx
MatplotLib.pptx
Paras Intotech
 
slides_python_ for basic operation of it
slides_python_ for basic operation of itslides_python_ for basic operation of it
slides_python_ for basic operation of it
sachinjadhav990783
 
Presentation: Plotting Systems in R
Presentation: Plotting Systems in RPresentation: Plotting Systems in R
Presentation: Plotting Systems in R
Ilya Zhbannikov
 
Use the Matplotlib, Luke @ PyCon Taiwan 2012
Use the Matplotlib, Luke @ PyCon Taiwan 2012Use the Matplotlib, Luke @ PyCon Taiwan 2012
Use the Matplotlib, Luke @ PyCon Taiwan 2012
Wen-Wei Liao
 
UNIT-5-II IT-DATA VISUALIZATION TECHNIQUES
UNIT-5-II IT-DATA VISUALIZATION TECHNIQUESUNIT-5-II IT-DATA VISUALIZATION TECHNIQUES
UNIT-5-II IT-DATA VISUALIZATION TECHNIQUES
hemalathab24
 
Seaborn for data visualization using python.pptx
Seaborn for data visualization using python.pptxSeaborn for data visualization using python.pptx
Seaborn for data visualization using python.pptx
sjcdsdocs
 
matplotlib _
matplotlib                                _matplotlib                                _
matplotlib _
swati463221
 
DDU Workshop Day-2 presentation (1).pptx
DDU Workshop Day-2 presentation (1).pptxDDU Workshop Day-2 presentation (1).pptx
DDU Workshop Day-2 presentation (1).pptx
ritu23mts5729
 
16. Data VIsualization using PyPlot.pdf
16. Data VIsualization using PyPlot.pdf16. Data VIsualization using PyPlot.pdf
16. Data VIsualization using PyPlot.pdf
RrCreations5
 
Tools for research plotting
Tools for research plottingTools for research plotting
Tools for research plotting
Nimrita Koul
 
Tools for research plotting
Tools for research plottingTools for research plotting
Tools for research plotting
Nimrita Koul
 
Data Visualization 2020_21
Data Visualization 2020_21Data Visualization 2020_21
Data Visualization 2020_21
Sangita Panchal
 
Python chart plotting using Matplotlib.pptx
Python chart plotting using Matplotlib.pptxPython chart plotting using Matplotlib.pptx
Python chart plotting using Matplotlib.pptx
sonali sonavane
 
matplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvf
matplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvfmatplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvf
matplotlib.pptxdsfdsfdsfdsdsfdsdfdsfsdf cvvf
zmulani8
 
Matplotlib yayyyyyyyyyyyyyin Python.pptx
Matplotlib yayyyyyyyyyyyyyin Python.pptxMatplotlib yayyyyyyyyyyyyyin Python.pptx
Matplotlib yayyyyyyyyyyyyyin Python.pptx
AamnaRaza1
 
Python Visualization API Primersubplots
Python Visualization  API PrimersubplotsPython Visualization  API Primersubplots
Python Visualization API Primersubplots
VidhyaB10
 
BASIC OF PYTHON MATPLOTLIB USED IN ARTIFICIAL INTELLIGENCE AND ML
BASIC OF PYTHON MATPLOTLIB USED IN ARTIFICIAL INTELLIGENCE AND MLBASIC OF PYTHON MATPLOTLIB USED IN ARTIFICIAL INTELLIGENCE AND ML
BASIC OF PYTHON MATPLOTLIB USED IN ARTIFICIAL INTELLIGENCE AND ML
AbhaysinhVansadia
 
Unit3-v1-Plotting and Visualization.pptx
Unit3-v1-Plotting and Visualization.pptxUnit3-v1-Plotting and Visualization.pptx
Unit3-v1-Plotting and Visualization.pptx
yerrasaniayyapparedd
 
UNit-III. part 2.pdf
UNit-III. part 2.pdfUNit-III. part 2.pdf
UNit-III. part 2.pdf
MastiCreation
 
slides_python_ for basic operation of it
slides_python_ for basic operation of itslides_python_ for basic operation of it
slides_python_ for basic operation of it
sachinjadhav990783
 
Presentation: Plotting Systems in R
Presentation: Plotting Systems in RPresentation: Plotting Systems in R
Presentation: Plotting Systems in R
Ilya Zhbannikov
 
Use the Matplotlib, Luke @ PyCon Taiwan 2012
Use the Matplotlib, Luke @ PyCon Taiwan 2012Use the Matplotlib, Luke @ PyCon Taiwan 2012
Use the Matplotlib, Luke @ PyCon Taiwan 2012
Wen-Wei Liao
 
UNIT-5-II IT-DATA VISUALIZATION TECHNIQUES
UNIT-5-II IT-DATA VISUALIZATION TECHNIQUESUNIT-5-II IT-DATA VISUALIZATION TECHNIQUES
UNIT-5-II IT-DATA VISUALIZATION TECHNIQUES
hemalathab24
 
Seaborn for data visualization using python.pptx
Seaborn for data visualization using python.pptxSeaborn for data visualization using python.pptx
Seaborn for data visualization using python.pptx
sjcdsdocs
 
DDU Workshop Day-2 presentation (1).pptx
DDU Workshop Day-2 presentation (1).pptxDDU Workshop Day-2 presentation (1).pptx
DDU Workshop Day-2 presentation (1).pptx
ritu23mts5729
 
16. Data VIsualization using PyPlot.pdf
16. Data VIsualization using PyPlot.pdf16. Data VIsualization using PyPlot.pdf
16. Data VIsualization using PyPlot.pdf
RrCreations5
 
Tools for research plotting
Tools for research plottingTools for research plotting
Tools for research plotting
Nimrita Koul
 
Tools for research plotting
Tools for research plottingTools for research plotting
Tools for research plotting
Nimrita Koul
 
Data Visualization 2020_21
Data Visualization 2020_21Data Visualization 2020_21
Data Visualization 2020_21
Sangita Panchal
 
Ad

More from sumitt6_25730773 (8)

Introduction to Numpy, NumPy Arrays.pdf
Introduction to Numpy, NumPy  Arrays.pdfIntroduction to Numpy, NumPy  Arrays.pdf
Introduction to Numpy, NumPy Arrays.pdf
sumitt6_25730773
 
Formwork Supports, Scaffolds and Failure.pdf
Formwork Supports, Scaffolds and Failure.pdfFormwork Supports, Scaffolds and Failure.pdf
Formwork Supports, Scaffolds and Failure.pdf
sumitt6_25730773
 
Formwork Design-Introduction.pdf
Formwork Design-Introduction.pdfFormwork Design-Introduction.pdf
Formwork Design-Introduction.pdf
sumitt6_25730773
 
Bending stresses and shear stresses
Bending stresses and shear stressesBending stresses and shear stresses
Bending stresses and shear stresses
sumitt6_25730773
 
Shear Force and Bending Moment Diagram
Shear Force and Bending Moment DiagramShear Force and Bending Moment Diagram
Shear Force and Bending Moment Diagram
sumitt6_25730773
 
Flow Through Pipe
Flow Through PipeFlow Through Pipe
Flow Through Pipe
sumitt6_25730773
 
Concept of Boundary Layer
Concept of Boundary LayerConcept of Boundary Layer
Concept of Boundary Layer
sumitt6_25730773
 
Flow through pipes
Flow through pipesFlow through pipes
Flow through pipes
sumitt6_25730773
 
Introduction to Numpy, NumPy Arrays.pdf
Introduction to Numpy, NumPy  Arrays.pdfIntroduction to Numpy, NumPy  Arrays.pdf
Introduction to Numpy, NumPy Arrays.pdf
sumitt6_25730773
 
Formwork Supports, Scaffolds and Failure.pdf
Formwork Supports, Scaffolds and Failure.pdfFormwork Supports, Scaffolds and Failure.pdf
Formwork Supports, Scaffolds and Failure.pdf
sumitt6_25730773
 
Formwork Design-Introduction.pdf
Formwork Design-Introduction.pdfFormwork Design-Introduction.pdf
Formwork Design-Introduction.pdf
sumitt6_25730773
 
Bending stresses and shear stresses
Bending stresses and shear stressesBending stresses and shear stresses
Bending stresses and shear stresses
sumitt6_25730773
 
Shear Force and Bending Moment Diagram
Shear Force and Bending Moment DiagramShear Force and Bending Moment Diagram
Shear Force and Bending Moment Diagram
sumitt6_25730773
 
Ad

Recently uploaded (20)

Reese McCrary_ The Role of Perseverance in Engineering Success.pdf
Reese McCrary_ The Role of Perseverance in Engineering Success.pdfReese McCrary_ The Role of Perseverance in Engineering Success.pdf
Reese McCrary_ The Role of Perseverance in Engineering Success.pdf
Reese McCrary
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
New Microsoft PowerPoint Presentation.pdf
New Microsoft PowerPoint Presentation.pdfNew Microsoft PowerPoint Presentation.pdf
New Microsoft PowerPoint Presentation.pdf
mohamedezzat18803
 
ZJIT: Building a Next Generation Ruby JIT
ZJIT: Building a Next Generation Ruby JITZJIT: Building a Next Generation Ruby JIT
ZJIT: Building a Next Generation Ruby JIT
maximechevalierboisv1
 
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Structural Response of Reinforced Self-Compacting Concrete Deep Beam Using Fi...
Journal of Soft Computing in Civil Engineering
 
Comparing Emerging Cloud Platforms –like AWS, Azure, Google Cloud, Cloud Stac...
Comparing Emerging Cloud Platforms –like AWS, Azure, Google Cloud, Cloud Stac...Comparing Emerging Cloud Platforms –like AWS, Azure, Google Cloud, Cloud Stac...
Comparing Emerging Cloud Platforms –like AWS, Azure, Google Cloud, Cloud Stac...
SiddhiKulkarni18
 
How to use nRF24L01 module with Arduino
How to use nRF24L01 module with ArduinoHow to use nRF24L01 module with Arduino
How to use nRF24L01 module with Arduino
CircuitDigest
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
MODULE 03 - CLOUD COMPUTING- [BIS 613D] 2022 scheme.pptx
MODULE 03 - CLOUD COMPUTING-  [BIS 613D] 2022 scheme.pptxMODULE 03 - CLOUD COMPUTING-  [BIS 613D] 2022 scheme.pptx
MODULE 03 - CLOUD COMPUTING- [BIS 613D] 2022 scheme.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Development of MLR, ANN and ANFIS Models for Estimation of PCUs at Different ...
Journal of Soft Computing in Civil Engineering
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
IJCNCJournal
 
Novel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth ControlNovel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth Control
Chris Harding
 
Reese McCrary_ The Role of Perseverance in Engineering Success.pdf
Reese McCrary_ The Role of Perseverance in Engineering Success.pdfReese McCrary_ The Role of Perseverance in Engineering Success.pdf
Reese McCrary_ The Role of Perseverance in Engineering Success.pdf
Reese McCrary
 
Level 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical SafetyLevel 1-Safety.pptx Presentation of Electrical Safety
Level 1-Safety.pptx Presentation of Electrical Safety
JoseAlbertoCariasDel
 
New Microsoft PowerPoint Presentation.pdf
New Microsoft PowerPoint Presentation.pdfNew Microsoft PowerPoint Presentation.pdf
New Microsoft PowerPoint Presentation.pdf
mohamedezzat18803
 
ZJIT: Building a Next Generation Ruby JIT
ZJIT: Building a Next Generation Ruby JITZJIT: Building a Next Generation Ruby JIT
ZJIT: Building a Next Generation Ruby JIT
maximechevalierboisv1
 
Comparing Emerging Cloud Platforms –like AWS, Azure, Google Cloud, Cloud Stac...
Comparing Emerging Cloud Platforms –like AWS, Azure, Google Cloud, Cloud Stac...Comparing Emerging Cloud Platforms –like AWS, Azure, Google Cloud, Cloud Stac...
Comparing Emerging Cloud Platforms –like AWS, Azure, Google Cloud, Cloud Stac...
SiddhiKulkarni18
 
How to use nRF24L01 module with Arduino
How to use nRF24L01 module with ArduinoHow to use nRF24L01 module with Arduino
How to use nRF24L01 module with Arduino
CircuitDigest
 
Introduction to FLUID MECHANICS & KINEMATICS
Introduction to FLUID MECHANICS &  KINEMATICSIntroduction to FLUID MECHANICS &  KINEMATICS
Introduction to FLUID MECHANICS & KINEMATICS
narayanaswamygdas
 
Smart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineeringSmart Storage Solutions.pptx for production engineering
Smart Storage Solutions.pptx for production engineering
rushikeshnavghare94
 
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E..."Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
"Boiler Feed Pump (BFP): Working, Applications, Advantages, and Limitations E...
Infopitaara
 
Smart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptxSmart_Storage_Systems_Production_Engineering.pptx
Smart_Storage_Systems_Production_Engineering.pptx
rushikeshnavghare94
 
AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)AI-assisted Software Testing (3-hours tutorial)
AI-assisted Software Testing (3-hours tutorial)
Vəhid Gəruslu
 
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptxExplainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
Explainable-Artificial-Intelligence-XAI-A-Deep-Dive (1).pptx
MahaveerVPandit
 
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptxLidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
Lidar for Autonomous Driving, LiDAR Mapping for Driverless Cars.pptx
RishavKumar530754
 
Data Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptxData Structures_Introduction to algorithms.pptx
Data Structures_Introduction to algorithms.pptx
RushaliDeshmukh2
 
Data Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptxData Structures_Searching and Sorting.pptx
Data Structures_Searching and Sorting.pptx
RushaliDeshmukh2
 
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
Efficient Algorithms for Isogeny Computation on Hyperelliptic Curves: Their A...
IJCNCJournal
 
Novel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth ControlNovel Plug Flow Reactor with Recycle For Growth Control
Novel Plug Flow Reactor with Recycle For Growth Control
Chris Harding
 

Introduction to Data Visualization,Matplotlib.pdf

  • 1. Sanjivani Rural Education Society's Sanjivani College of Engineering, Kopargaon 423603. -Department of Strucutral Engineering- By Mr. Sumit S. Kolapkar (Assistant Professor) Mail Id- [email protected]
  • 2. Ø Why data visualization in Python- • Is a quick and easy way to convey the concepts in a universal manner. Ø What is data visualization- • Is a graphical way of representing information and data. Ø Types of data visualization in Python- • Plotting Libraries- • Matplotlib- • Pandas Visualization- • Seaborn- • ggplot- • Plotly-
  • 3. Ø What is Matplotlib- • Is a plotting library for Python and it is numerical mathematical extension of Numpy • Is 2D and 3D plotting Python library • It was introduced by John Hunter in the year 2002 Ø Matplotlib graphs-
  • 4. Ø Importing Matplotlib in Python- • import matplotlib.pyplot as plt OR • from matplotlib import pyplot as plt Example- import matplotlib.pyplot as plt x=[1,2,3,4,5] y=[6,7,8,9,10] plt.plot(x,y) plt.show () Example- import matplotlib.pyplot as plt x=[1,2,3,4,5] y=[6,7,8,9,10] plt.bar(x,y) plt.show ()
  • 5. Ø Importing Matplotlib in Python- Example- import matplotlib.pyplot as plt x=[1,2,3,4,5] y=[6,7,8,9,10] Z=['b','g','r','black','pink'] plt.bar(x,y,color=Z) plt.show () Base Color-
  • 7. Ø Matplotlib Bar Plot- • import matplotlib.pyplot as plt x = ['Python','C','C++', 'Java'] y = [90,65,82,85] plt.bar(x,y) plt.show ()
  • 8. Ø Matplotlib Bar Plot- • import matplotlib.pyplot as plt x=[ ] y=[ ] z=[ ] plt.bar(x,y, width=0.4, color=“y”, align= “edge” (or center), edgecolor=“r”, linewidth=10, linestyle=“:”, alpha=0.4, label=“Popularity”) plt.bar(x,z, width=0.4, color=“g”, align=edge, edgecolor=“r”, linewidth=10, linestyle=“:”, alpha=0.4, label=“Popularity1”)...for multiple bar graphs plt.legend() plt.show( ) plt.xlabel (“languages”, fontsize=10) plt.ylabel(“No.” ”, font size=10) plt.title(“Graph1” ”, font size=10) Note- To apply the label we must apply for legend.
  • 9. Ø Matplotlib Bar Plot- • import matplotlib.pyplot as plt x=[ ] y=[ ] z=[ ] plt.bar(x,y, width=0.4, color=“y”,label=“Popularity”) plt.bar(x,z, width=0.4, color=“g”, label=“Popularity1”)...for multiple bar graphs.....overlapped plt.legend() plt.show( ) plt.xlabel (“languages”, fontsize=10) plt.ylabel(“No.” ”, font size=10) plt.title(“Graph1” ”, font size=10) Note- To apply the label we must apply for legend.
  • 10. Ø Matplotlib Bar Plot- Side by Side Graph • import matplotlib.pyplot as plt • import numpy as np x=[ “python”, “c”, “c++”, “java”] y=[80,70,60,82 ] z=[ 20,30,40,50] p = [0,1,2,3].....indexing of x OR p = np.arange(len(x))...by importing numpy also we can create an array of indexing width = 0.4 plt.bar(p,y, width, color=“y”,label=“Popularity”)....x replaced with ‘p’ plt.bar(p,z, width, color=“g”, label=“Popularity1”)....x replaced with ‘p’ plt.legend() plt.show( ) plt.xlabel (“languages”, fontsize=10) plt.ylabel(“No.” ”, font size=10) plt.title(“Graph1” ”, font size=10) Note- To apply the label we must apply for legend. gives number at x-axis and is over lapped
  • 11. Ø Matplotlib Bar Plot- Side by Side Graph • import matplotlib.pyplot as plt • import numpy as np x=[ “python”, “c”, “c++”, “java”] y=[80,70,60,82 ] z=[ 20,30,40,50] width = 0.4 p = np.arange(len(x)) p1=[ j+width for j in p]...will create another graph of same width on side plt.bar(p,y, width, color=“y”,label=“Popularity”)....x replaced with ‘p’ plt.bar(p1,z, width, color=“g”, label=“Popularity1”)....x replaced with ‘p’ plt.legend() plt.show( ) plt.xlabel (“languages”, fontsize=10) plt.ylabel(“No.” ”, font size=10) plt.title(“Graph1” ”, font size=10) Note- To apply the label we must apply for legend. gives number at x-axis
  • 12. Ø Matplotlib Bar Plot- Side by Side Graph • import matplotlib.pyplot as plt • import numpy as np x=[ “python”, “c”, “c++”, “java”] y=[80,70,60,82 ] z=[ 20,30,40,50] width = 0.4 p = np.arange(len(x)) p1=[ j+width for j in p]...will create another graph of same width on side plt.bar(p,y, width, color=“y”,label=“Popularity”)....x replaced with ‘p’ plt.bar(p1,z, width, color=“g”, label=“Popularity1”)....x replaced with ‘p’ plt.xticks(p+width,x)......to show name at x-axisand at right hand side plt.legend() plt.show( ) plt.xlabel (“languages”, fontsize=10) plt.ylabel(“No.” ”, font size=10) plt.title(“Graph1” ”, font size=10) Note- To apply the label we must apply for legend. gives name at RHS
  • 13. Ø Matplotlib Bar Plot- Side by Side Graph • import matplotlib.pyplot as plt • import numpy as np x=[ “python”, “c”, “c++”, “java”] y=[80,70,60,82 ] z=[ 20,30,40,50] width = 0.4 p = np.arange(len(x)) p1=[ j+width for j in p]...will create another graph of same width on side plt.bar(p,y, width, color=“y”,label=“Popularity”)....x replaced with ‘p’ plt.bar(p1,z, width, color=“g”, label=“Popularity1”)....x replaced with ‘p’ plt.xticks(p+width/2,x,rotation=10)......to show name at x-axis and at center plt.legend() plt.show( ) plt.xlabel (“languages”, fontsize=10) plt.ylabel(“No.” ”, font size=10) plt.title(“Graph1” ”, font size=10) Note- To apply the label we must apply for legend. gives name in rotation
  • 14. Ø Matplotlib Bar Plot- Horizontal Graph • import matplotlib.pyplot as plt • import numpy as np • x=['Python','C','C++', 'Java'] • y=[90,65,82,85] • z=[23,52,29,20] • width = 0.8 • p=np.arange(len(x)) • p1=[j+width for j in p] • plt.barh(p,y, width, color='r') • plt.bar(p1,z, width, color='k') • plt.xticks(p+width/2,x,rotation=50) • plt.show ()
  • 15. Ø Matplotlib Step Plot- • import matplotlib.pyplot as plt x=[ ] y=[ ] plt.step(x,y,marker= “o”, color= “r”, ms=10, mfc= “g”) plt.legend() plt.grid() plt.show( ) plt.xlabel (“languages”, font size=10) plt.ylabel(“No.” ”, font size=10) plt.title(“Graph1” ”, font size=10) Note-To align the bars on the right edge pass a negative width and align='edge'
  • 16. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • plt.pie(x) • plt.show () • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • plt.pie(x,labels=y) • plt.show ()
  • 17. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z) • plt.show () • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • var1=["r","c","g","orange"] • plt.pie(x,labels=y,explode=z,colors=var1) • plt.show ()
  • 18. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • var1=["r","c","g","orange"] • plt.pie(x,labels=y,explode=z,colors=var1,autopct="%0. 1f%%")
  • 19. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • var1=["r","c","g","orange"] • plt.pie(x,labels=y,explode=z,colors=var1,autopct="%0. 3f%%")
  • 20. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",shad ow=True) • plt.show ()
  • 21. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",radiu s=1.5) • plt.show ()
  • 22. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",label distance=1.3) • plt.show ()
  • 23. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",start angle=90) • plt.show ()
  • 24. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",textp rops={"fontsize":15}) • plt.show ()
  • 25. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",textp rops={"fontsize":15},counterclock=False) • plt.show ()
  • 26. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",shad ow=True,textprops={"fontsize":15},wedgeprops={"line width":5}) • plt.show ()
  • 27. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",shad ow=True,textprops={"fontsize":15},wedgeprops={"line width":5,"edgecolor":"c"}) • plt.show ()
  • 28. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",shad ow=True,textprops={"fontsize":15},wedgeprops={"line width":5},rotatelabels=True) • plt.show ()
  • 29. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",radiu s=0.9,shadow=True,textprops={"fontsize":15},wedgep rops={"linewidth":5},rotatelabels=True) • plt.title("Computers and Structures") • plt.show ()
  • 30. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,explode=z,autopct="%0.3f%%",radiu s=0.9,shadow=True,textprops={"fontsize":15},wedgep rops={"linewidth":5},rotatelabels=True) • plt.title("Computers and Structures") • plt.legend(loc=1).....loc=1 to 10 • plt.show ()
  • 31. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • x1=[40,30,20,10] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,radius=1.5) • plt.pie(x1,radius=1) • plt.show ()
  • 32. Ø Matplotlib Pie Plot- • import matplotlib.pyplot as plt • x=[1,2,3,4] • x1=[40,30,20,10] • y=["C","C++","Java","Python"] • z=[0.4,0.0,0.0,0.0] • plt.pie(x,labels=y,radius=1.5) • plt.pie([1],colors="w",radius=1) • plt.show ()
  • 33. Ø Matplotlib Save Figure- • import matplotlib.pyplot as plt x=[ ] y=[ ] plt.plot(x,y) plt.savefig(“fname”, dpi=1000, facecolor= “g”, transparent=True) plt.savefig(fname.pdf)......save in format as per requirement plt.show( ) Ex- import matplotlib.pyplot as plt x=[1,2,3,4,5] y=[90,65,82,85,80] plt.plot(x,y) plt.savefig("line") plt.show() Note- File gets saved in a folder location
  • 34. Ø Matplotlib Work With Axes- • import matplotlib.pyplot as plt • x=[1,2,3,4,5] • y=[3,2,1,3,4] • plt.plot(x,y) • plt.xticks(x) • plt.yticks(x) • plt.show ()
  • 35. Ø Matplotlib Work With Axes- • import matplotlib.pyplot as plt • x=[1,2,3,4,5] • y=[3,2,1,3,4] • plt.plot(x,y) • plt.xticks(x,labels=["Python","Java","C","C++","HTML"]) • plt.yticks(x) • plt.show ()
  • 36. Ø Matplotlib Work With Axes- • import matplotlib.pyplot as plt • x=[1,2,3,4,5] • y=[3,2,1,3,4] • plt.plot(x,y) • plt.xlim(0,10) • plt.show ()
  • 37. Ø Matplotlib Work With Axes- • import matplotlib.pyplot as plt • x=[1,2,3,4,5] • y=[3,2,1,3,4] • plt.plot(x,y) • plt.axis([0,10,0,7]) • plt.show ()
  • 38. Ø Text in Matplotlib- text- Add text at an arbitrary location of the axes. annotate- Add an annotation with an optional arrow at an arbitrary location of the axes xlabel- Add a label to the axes’s along x-axis ylabel- Add a label to the axes’s along y-axis title- Add a title to the axes
  • 39. Ø Text in Matplotlib- Ex- import matplotlib.pyplot as plt x=[1,2,3,4,5] y=[3,2,1,3,4] plt.plot(x,y) plt.text(2,3,"java",style="italic",bbox={"facecolor":"c"}) plt.annotate("python",xy=(2,1),xytext=(4,4),arrowprops=dict(facec olor="green")) plt.legend(["up"],loc=9,facecolor="red",edgecolor="c",framealpha =0.5,shadow=True) plt.show () text position on x and y axis