SlideShare une entreprise Scribd logo
1  sur  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

Contenu connexe

Tendances

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

Similaire à 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
 

Similaire à 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
 

Plus de 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
 

Dernier

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
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
dharasingh5698
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
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
 

Dernier (20)

(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
Introduction to Serverless with AWS Lambda
Introduction to Serverless with AWS LambdaIntroduction to Serverless with AWS Lambda
Introduction to Serverless with AWS Lambda
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
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
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
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
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
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
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
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...
 
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
 
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoorTop Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
Top Rated Call Girls In chittoor 📱 {7001035870} VIP Escorts chittoor
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
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
 
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
 

Python programing

Notes de l'éditeur

  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