SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Kürzlich hochgeladen

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
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
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
 

Kürzlich hochgeladen (20)

Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
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
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
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
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
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 Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
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
 
(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
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
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
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
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
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
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
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 

Python programing

Hinweis der Redaktion

  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