SlideShare a Scribd company logo
1 of 10
outline
about
body
graph
conclude
exercise
outline
about
body
graph
conclude
exercise
Importing module & plot syntax
Decorating graph
Multiple plotting & Bar graph
4 plots in single Graph
Start
Finish
outline
about
body
graph
conclude
exercise
Importing Module & Plot Syntax
Plotting means to represent graphically.
Import modules:
1)Numpy
-->import numpy as np
2)Matplotlib
-->import matplotlib.pyplot as plt
Syntax:
x=linspace(start, stop, num)
plot(x,y)
-->x=np.linspace(0, 2*np.pi, 50)
-->plt.plot(x, np.sin(x))
outline
about
body
graph
conclude
exercise Decorating Graph
Adding Labels:
xlabel(‘ ‘) & ylabel(‘ ‘)
-->plt.xlabel(‘x’)
-->plt.ylabel(‘sin(x)’)
Giving Tiltle:
title(‘ ‘)
-->plt.title(‘Sinusoidis’)
Plot Function:
plot(x, y, ‘color’, linewidth)
-->plt.plot(x, np.sin(x), ‘r’, linewidth=3)
outline
about
body
graph
conclude
exercise
Some More Decoration
Adding legend:
legend([‘ ‘] , loc=‘best‘)
-->plt.legend([‘Sin(x)’], loc=‘right’)
Annotating:
annotate(‘title’, xy=(x value, y value))
-->plt.annotate(‘localmax’, xy=(1.5, 1))
Axes Length:
xmin, xmax = xlim( )
ymin, ymax = ylim( )
-->plt.xlim(0, 2*np.pi)
-->plt.ylim(-1, 1)
outline
about
body
graph
conclude
exercise
Multiple Plotting
outline
about
body
graph
conclude
exercise
Bar Graph
Code:
import numpy as np
import matplotlib.pyplot as plt
objects = ('Python', 'C++', 'Java', 'Perl', 'Scala', 'Lisp')
y_pos = np.arange(len(objects))
performance = [10, 8, 6, 4, 2, 1]
plt.bar(y_pos, performance, align='center', alpha=0.5)
plt.xticks(y_pos, objects)
plt.xlabel('Objects')
plt.ylabel('Usage')
plt.title('Programming language usage')
outline
about
body
graph
conclude
exercise
4 plots in Single Graph
Plot x, -x, sin(x), xsin(x), in range -5pie to 5pie
Add a legend, Annotate the origin, Set axis limit to the range of X
Code:
import numpy as np
import matplotlib.pyplot as plt
x= np.linspace(-5*np.pi, 5*np.pi, 500)
plt.plot(x, x, 'b')
plt.plot(x, -x, 'b')
plt.plot(x, np.sin(x), 'g', linewidth=2)
plt.plot(x, x*np.sin(x), 'r', linewidth=3)
plt.xlabel('x axis-->')
plt.ylabel('y axis-->')
plt.legend(['x', '-x', 'sin(x)', 'xsin(x)'])
plt.annotate('origin', xy=(0,0))
plt.xlim(-5*np.pi, 5*np.pi)
plt.ylim(-5*np.pi, 5*np.pi)
outline
about
body
graph
conclude
exercise
MCQ Question
How will you set X and Y axis limit of a plot so that the region of
the interest is in the rectangle (0,-1.5) (bottom left co-ordinate)
and (2*pi,1.5) (right top co-ordinate)
a) Xlim(0, 2*pi)
Ylim(-1.5, 1.5)
b) Xlim(0, -1.5)
Ylim(2*pi, 1.5)
c) Xlim(2*pi, 0)
Ylim(1.5, -1.5)
d) Xlim(-1.5, 1.5)
Ylim(0, 2*pi)
Python programing

More Related Content

What's hot

What's hot (19)

NCCU: Statistics in the Criminal Justice System, R basics and Simulation - Pr...
NCCU: Statistics in the Criminal Justice System, R basics and Simulation - Pr...NCCU: Statistics in the Criminal Justice System, R basics and Simulation - Pr...
NCCU: Statistics in the Criminal Justice System, R basics and Simulation - Pr...
 
Graph Plots in Matlab
Graph Plots in MatlabGraph Plots in Matlab
Graph Plots in Matlab
 
バイオインフォ分野におけるtidyなデータ解析の最新動向
バイオインフォ分野におけるtidyなデータ解析の最新動向バイオインフォ分野におけるtidyなデータ解析の最新動向
バイオインフォ分野におけるtidyなデータ解析の最新動向
 
20170317 functional programming in julia
20170317 functional programming in julia20170317 functional programming in julia
20170317 functional programming in julia
 
1 seaborn introduction
1 seaborn introduction 1 seaborn introduction
1 seaborn introduction
 
Experement no 6
Experement no 6Experement no 6
Experement no 6
 
The matplotlib Library
The matplotlib LibraryThe matplotlib Library
The matplotlib Library
 
imager package in R and examples..
imager package in R and examples..imager package in R and examples..
imager package in R and examples..
 
Class 8b: Numpy & Matplotlib
Class 8b: Numpy & MatplotlibClass 8b: Numpy & Matplotlib
Class 8b: Numpy & Matplotlib
 
simple linear regression
simple linear regressionsimple linear regression
simple linear regression
 
Advanced Concepts in Python
Advanced Concepts in PythonAdvanced Concepts in Python
Advanced Concepts in Python
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics Functions
 
program on Function overloading in java
program on  Function overloading in javaprogram on  Function overloading in java
program on Function overloading in java
 
Functional Programming inside OOP? It’s possible with Python
Functional Programming inside OOP? It’s possible with PythonFunctional Programming inside OOP? It’s possible with Python
Functional Programming inside OOP? It’s possible with Python
 
Pythonbrasil - 2018 - Acelerando Soluções com GPU
Pythonbrasil - 2018 - Acelerando Soluções com GPUPythonbrasil - 2018 - Acelerando Soluções com GPU
Pythonbrasil - 2018 - Acelerando Soluções com GPU
 
Computer hw1
Computer hw1Computer hw1
Computer hw1
 
Matlab plotting
Matlab plottingMatlab plotting
Matlab plotting
 
Heap sort & bubble sort
Heap sort & bubble sortHeap sort & bubble sort
Heap sort & bubble sort
 
Running Free with the Monads
Running Free with the MonadsRunning Free with the Monads
Running Free with the Monads
 

Similar to Python programing

More instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docxMore instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docx
gilpinleeanna
 

Similar to Python programing (20)

SCIPY-SYMPY.pdf
SCIPY-SYMPY.pdfSCIPY-SYMPY.pdf
SCIPY-SYMPY.pdf
 
Introduction to Machine Learning
Introduction to Machine LearningIntroduction to Machine Learning
Introduction to Machine Learning
 
MatplotLib.pptx
MatplotLib.pptxMatplotLib.pptx
MatplotLib.pptx
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdf
 
ML with python.pdf
ML with python.pdfML with python.pdf
ML with python.pdf
 
AI02_Python (cont.).pptx
AI02_Python (cont.).pptxAI02_Python (cont.).pptx
AI02_Python (cont.).pptx
 
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
 
Numpy - Array.pdf
Numpy - Array.pdfNumpy - Array.pdf
Numpy - Array.pdf
 
Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화
 
Arrays in python
Arrays in pythonArrays in python
Arrays in python
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
From NumPy to PyTorch
From NumPy to PyTorchFrom NumPy to PyTorch
From NumPy to PyTorch
 
Introducción a Elixir
Introducción a ElixirIntroducción a Elixir
Introducción a Elixir
 
Machine Learning Algorithms
Machine Learning AlgorithmsMachine Learning Algorithms
Machine Learning Algorithms
 
Seminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mmeSeminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mme
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report
 
Python 03-parameters-graphics.pptx
Python 03-parameters-graphics.pptxPython 03-parameters-graphics.pptx
Python 03-parameters-graphics.pptx
 
Monadologie
MonadologieMonadologie
Monadologie
 
An Introduction to Functional Programming using Haskell
An Introduction to Functional Programming using HaskellAn Introduction to Functional Programming using Haskell
An Introduction to Functional Programming using Haskell
 
More instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docxMore instructions for the lab write-up1) You are not obli.docx
More instructions for the lab write-up1) You are not obli.docx
 

More from BHAVYA DOSHI (7)

Learning form legends
Learning form legendsLearning form legends
Learning form legends
 
Failures
FailuresFailures
Failures
 
Analog and Digital Communication
Analog and Digital CommunicationAnalog and Digital Communication
Analog and Digital Communication
 
Microprocessor and Controller
Microprocessor and ControllerMicroprocessor and Controller
Microprocessor and Controller
 
Teamwork and Harmony
Teamwork and HarmonyTeamwork and Harmony
Teamwork and Harmony
 
Interview skills
Interview skillsInterview skills
Interview skills
 
Air pollution
Air pollutionAir pollution
Air pollution
 

Recently uploaded

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Palanpur 7001035870 Whatsapp Number, 24/07 Booking
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf22-prompt engineering noted slide shown.pdf
22-prompt engineering noted slide shown.pdf
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 

Python programing

Editor's Notes

  1. For maths and for plotting graph ---plot x,y using defalt line style and colour
  2. ---- plot decoration to show graph better
  3. Center,right,left ----------min and origin