SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Downloaden Sie, um offline zu lesen
 python 2D plotting library which produces
publication quality figures in
› a variety of hardcopy formats
› interactive environments
import matplotlib.pyplot as plt
# x data, y data, style
plt.plot([1,2,3,4], [5,6,7,8], 'r-')
# [x min, x max, y min, y max]
plt.axis([0, 5, 0, 9])
plt.ylabel('some numbers')
plt.show()
 Draw the graph(y =
x^2).
x = range(100)
y = [i * i for i in x]
plt.plot(x, y, 'r-')
plt.ylabel('y = x^2')
plt.show()
import matplotlib.pyplot as plt
data = [2, 7, 6, 4, 1, 10, 3, 2, 4, 5, 3, 1]
plt.hist(data, bins=8, facecolor='blue')
plt.show()
import matplotlib.pyplot as plt
# The slices will be ordered and plotted counter-clockwise.
labels = 'Fuji', 'Tsugaru', 'Orin', 'Jonagold', 'Other'
sizes = [235500, 50600, 47100, 45700, 89100]
colors = ['orangered', 'red', 'greenyellow', 'orangered', 'gold']
explode = (0, 0, 0.1, 0, 0) # only "explode" the 3rd slice (i.e. 'Orin')
plt.pie(sizes, explode=explode, labels=labels, colors=colors,
autopct='%1.1f%%', shadow=True, startangle=90, counterclock=False)
# Set aspect ratio to be equal so that pie is drawn as a circle.
plt.axis('equal')
plt.show()
import numpy as np # use numpy
import matplotlib.pyplot as plt
x = np.array(range(10))
# red line
plt.plot(x, x, ls='-', c='red')
# blue circles
plt.plot(x, x**1.25, ls='', c='blue', marker='o')
# green stars
plt.plot(x, x**1.5, ls='', c='green', marker='*')
plt.show()
 For more properties, do
› lines=plt.plot([1, 2, 3])
› plt.setp(lines)
import numpy as np
import matplotlib.pyplot as plt
x = np.array(range(10))
# first figure
plt.figure(1)
# num of row, num of column, num of axis
plt.subplot(2, 3, 1)
plt.plot(x, x, 'r')
plt.subplot(2, 3, 2)
plt.plot(x, x, 'bo')
plt.show()
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 1, 0.001)
y = x**1.5
plt.plot(x, y, 'r')
plt.xlabel(r'$x$')
plt.ylabel(r'$y=x^{1.5}$')
plt.title(r'Graph of $y=x^{1.5}$')
plt.text(0.3, 0.25, r'$y=x^{1.5}$')
plt.grid(True)
plt.show()
 Draw the graph of
binary entropy
function
𝐻 𝑝 = −𝑝log2 𝑝 − 1 − 𝑝 log2 1 − 𝑝
› Hint: use np.log2 to
calculate log2
import numpy as np
import matplotlib.pyplot as plt
p = np.arange(0, 1, 0.001)
H = -p*np.log2(p) - (1-p)*np.log2(1-p)
plt.plot(p, H, 'r')
plt.xlabel(r'$p$')
plt.ylabel(r'$H(p)=-p ¥log_{2}(p)-(1-p)¥log_{2}(1-p)$')
plt.title('Binary Entropy Function')
plt.grid(True)
plt.show()
 Matplotlib tutorial
http://matplotlib.org/users/pyplot_tutorial.html
 りんご大学 - 品種別生産量の推移
http://www.ringodaigaku.com/study/statistics/
production_kind.html

Weitere ähnliche Inhalte

Was ist angesagt?

Pandas pythonfordatascience
Pandas pythonfordatasciencePandas pythonfordatascience
Pandas pythonfordatascienceNishant Upadhyay
 
1 seaborn introduction
1 seaborn introduction 1 seaborn introduction
1 seaborn introduction YuleiLi3
 
Python seaborn cheat_sheet
Python seaborn cheat_sheetPython seaborn cheat_sheet
Python seaborn cheat_sheetNishant Upadhyay
 
R scatter plots
R scatter plotsR scatter plots
R scatter plotsAbhik Seal
 
Python matplotlib cheat_sheet
Python matplotlib cheat_sheetPython matplotlib cheat_sheet
Python matplotlib cheat_sheetNishant Upadhyay
 
Presentation: Plotting Systems in R
Presentation: Plotting Systems in RPresentation: Plotting Systems in R
Presentation: Plotting Systems in RIlya Zhbannikov
 
Scientific Computing with Python - NumPy | WeiYuan
Scientific Computing with Python - NumPy | WeiYuanScientific Computing with Python - NumPy | WeiYuan
Scientific Computing with Python - NumPy | WeiYuanWei-Yuan Chang
 
Javascript Array map method
Javascript Array map methodJavascript Array map method
Javascript Array map methodtanerochris
 
imager package in R and examples..
imager package in R and examples..imager package in R and examples..
imager package in R and examples..Dr. Volkan OBAN
 
Mi primer map reduce
Mi primer map reduceMi primer map reduce
Mi primer map reduceRuben Orta
 
Mi primer map reduce
Mi primer map reduceMi primer map reduce
Mi primer map reducebetabeers
 
Surface3d in R and rgl package.
Surface3d in R and rgl package.Surface3d in R and rgl package.
Surface3d in R and rgl package.Dr. Volkan OBAN
 

Was ist angesagt? (20)

Pandas pythonfordatascience
Pandas pythonfordatasciencePandas pythonfordatascience
Pandas pythonfordatascience
 
Excel/R
Excel/RExcel/R
Excel/R
 
Python bokeh cheat_sheet
Python bokeh cheat_sheet Python bokeh cheat_sheet
Python bokeh cheat_sheet
 
1 seaborn introduction
1 seaborn introduction 1 seaborn introduction
1 seaborn introduction
 
Python seaborn cheat_sheet
Python seaborn cheat_sheetPython seaborn cheat_sheet
Python seaborn cheat_sheet
 
R-Excel Integration
R-Excel IntegrationR-Excel Integration
R-Excel Integration
 
R scatter plots
R scatter plotsR scatter plots
R scatter plots
 
Numpy python cheat_sheet
Numpy python cheat_sheetNumpy python cheat_sheet
Numpy python cheat_sheet
 
Python matplotlib cheat_sheet
Python matplotlib cheat_sheetPython matplotlib cheat_sheet
Python matplotlib cheat_sheet
 
Om (Cont.)
Om (Cont.)Om (Cont.)
Om (Cont.)
 
Presentation: Plotting Systems in R
Presentation: Plotting Systems in RPresentation: Plotting Systems in R
Presentation: Plotting Systems in R
 
Scientific Computing with Python - NumPy | WeiYuan
Scientific Computing with Python - NumPy | WeiYuanScientific Computing with Python - NumPy | WeiYuan
Scientific Computing with Python - NumPy | WeiYuan
 
Javascript Array map method
Javascript Array map methodJavascript Array map method
Javascript Array map method
 
C++ ammar .s.q
C++  ammar .s.qC++  ammar .s.q
C++ ammar .s.q
 
imager package in R and examples..
imager package in R and examples..imager package in R and examples..
imager package in R and examples..
 
Mi primer map reduce
Mi primer map reduceMi primer map reduce
Mi primer map reduce
 
Mi primer map reduce
Mi primer map reduceMi primer map reduce
Mi primer map reduce
 
Graph Plots in Matlab
Graph Plots in MatlabGraph Plots in Matlab
Graph Plots in Matlab
 
Surface3d in R and rgl package.
Surface3d in R and rgl package.Surface3d in R and rgl package.
Surface3d in R and rgl package.
 
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
CLIM Undergraduate Workshop: Tutorial on R Software - Huang Huang, Oct 23, 2017
 

Andere mochten auch

City manager performance appraisal
City manager performance appraisalCity manager performance appraisal
City manager performance appraisalorlaquirke2
 
Presentasi Penyuluhan Arica Rovi Susanti 2014
Presentasi Penyuluhan Arica Rovi Susanti 2014Presentasi Penyuluhan Arica Rovi Susanti 2014
Presentasi Penyuluhan Arica Rovi Susanti 2014Arica Susanti
 
Top 8 product marketing specialist resume samples
Top 8 product marketing specialist resume samplesTop 8 product marketing specialist resume samples
Top 8 product marketing specialist resume sampleshallerharry710
 
Loan advisor performance appraisal
Loan advisor performance appraisalLoan advisor performance appraisal
Loan advisor performance appraisalbillmohamed41
 
It program manager performance appraisal
It program manager performance appraisalIt program manager performance appraisal
It program manager performance appraisalorlaquirke2
 
Resume-Amar.compressed
Resume-Amar.compressedResume-Amar.compressed
Resume-Amar.compressedAmarjeet Kumar
 
How to get the best from your CFO
How to get the best from your CFOHow to get the best from your CFO
How to get the best from your CFOMyCFO Services
 
chuyên làm phim quảng cáo 3d
chuyên làm phim quảng cáo 3dchuyên làm phim quảng cáo 3d
chuyên làm phim quảng cáo 3dkerry743
 

Andere mochten auch (13)

City manager performance appraisal
City manager performance appraisalCity manager performance appraisal
City manager performance appraisal
 
이야기test
이야기test이야기test
이야기test
 
Prezentacja
PrezentacjaPrezentacja
Prezentacja
 
Presentasi Penyuluhan Arica Rovi Susanti 2014
Presentasi Penyuluhan Arica Rovi Susanti 2014Presentasi Penyuluhan Arica Rovi Susanti 2014
Presentasi Penyuluhan Arica Rovi Susanti 2014
 
Top 8 product marketing specialist resume samples
Top 8 product marketing specialist resume samplesTop 8 product marketing specialist resume samples
Top 8 product marketing specialist resume samples
 
Setting the Tone
Setting the ToneSetting the Tone
Setting the Tone
 
Loan advisor performance appraisal
Loan advisor performance appraisalLoan advisor performance appraisal
Loan advisor performance appraisal
 
wcbg-nhd-stack
wcbg-nhd-stackwcbg-nhd-stack
wcbg-nhd-stack
 
It program manager performance appraisal
It program manager performance appraisalIt program manager performance appraisal
It program manager performance appraisal
 
Resume-Amar.compressed
Resume-Amar.compressedResume-Amar.compressed
Resume-Amar.compressed
 
How to get the best from your CFO
How to get the best from your CFOHow to get the best from your CFO
How to get the best from your CFO
 
paper_2
paper_2paper_2
paper_2
 
chuyên làm phim quảng cáo 3d
chuyên làm phim quảng cáo 3dchuyên làm phim quảng cáo 3d
chuyên làm phim quảng cáo 3d
 

Ähnlich wie Py lecture5 python plots

Linear Logistic regession_Practical.pptx
Linear Logistic regession_Practical.pptxLinear Logistic regession_Practical.pptx
Linear Logistic regession_Practical.pptxDr. Amanpreet Kaur
 
Regression Tree.pdf
Regression Tree.pdfRegression Tree.pdf
Regression Tree.pdfIvanHartana4
 
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 2012Wen-Wei Liao
 
BUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfBUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfkarthikaparthasarath
 
Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화Tae wook kang
 
UNit-III. part 2.pdf
UNit-III. part 2.pdfUNit-III. part 2.pdf
UNit-III. part 2.pdfMastiCreation
 
statistical computation using R- an intro..
statistical computation using R- an intro..statistical computation using R- an intro..
statistical computation using R- an intro..Kamarudheen KV
 
16. Data VIsualization using PyPlot.pdf
16. Data VIsualization using PyPlot.pdf16. Data VIsualization using PyPlot.pdf
16. Data VIsualization using PyPlot.pdfRrCreations5
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdfsrxerox
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptAnishaJ7
 
Python basic
Python basic Python basic
Python basic sewoo lee
 
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov VyacheslavSeminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov VyacheslavVyacheslav Arbuzov
 
Programs in array using SWIFT
Programs in array using SWIFTPrograms in array using SWIFT
Programs in array using SWIFTvikram mahendra
 
Frsa
FrsaFrsa
Frsa_111
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語ikdysfm
 
decision tree regression
decision tree regressiondecision tree regression
decision tree regressionAkhilesh Joshi
 

Ähnlich wie Py lecture5 python plots (20)

MatplotLib.pptx
MatplotLib.pptxMatplotLib.pptx
MatplotLib.pptx
 
Linear Logistic regession_Practical.pptx
Linear Logistic regession_Practical.pptxLinear Logistic regession_Practical.pptx
Linear Logistic regession_Practical.pptx
 
Regression Tree.pdf
Regression Tree.pdfRegression Tree.pdf
Regression Tree.pdf
 
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
 
BUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdfBUilt in Functions and Simple programs in R.pdf
BUilt in Functions and Simple programs in R.pdf
 
Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화Python과 node.js기반 데이터 분석 및 가시화
Python과 node.js기반 데이터 분석 및 가시화
 
UNit-III. part 2.pdf
UNit-III. part 2.pdfUNit-III. part 2.pdf
UNit-III. part 2.pdf
 
statistical computation using R- an intro..
statistical computation using R- an intro..statistical computation using R- an intro..
statistical computation using R- an intro..
 
16. Data VIsualization using PyPlot.pdf
16. Data VIsualization using PyPlot.pdf16. Data VIsualization using PyPlot.pdf
16. Data VIsualization using PyPlot.pdf
 
III MCS python lab (1).pdf
III MCS python lab (1).pdfIII MCS python lab (1).pdf
III MCS python lab (1).pdf
 
Python High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.pptPython High Level Functions_Ch 11.ppt
Python High Level Functions_Ch 11.ppt
 
Python basic
Python basic Python basic
Python basic
 
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov VyacheslavSeminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
Seminar PSU 09.04.2013 - 10.04.2013 MiFIT, Arbuzov Vyacheslav
 
Programs in array using SWIFT
Programs in array using SWIFTPrograms in array using SWIFT
Programs in array using SWIFT
 
CLUSTERGRAM
CLUSTERGRAMCLUSTERGRAM
CLUSTERGRAM
 
Matplotlib
MatplotlibMatplotlib
Matplotlib
 
Frsa
FrsaFrsa
Frsa
 
Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語Haskellで学ぶ関数型言語
Haskellで学ぶ関数型言語
 
decision tree regression
decision tree regressiondecision tree regression
decision tree regression
 
Seminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mmeSeminar PSU 10.10.2014 mme
Seminar PSU 10.10.2014 mme
 

Mehr von Yoshiki Satotani

Mehr von Yoshiki Satotani (7)

Basic practice of R
Basic practice of RBasic practice of R
Basic practice of R
 
Basic use of Python (Practice)
Basic use of Python (Practice)Basic use of Python (Practice)
Basic use of Python (Practice)
 
Basic use of Python
Basic use of PythonBasic use of Python
Basic use of Python
 
PyLecture4 -Python Basics2-
PyLecture4 -Python Basics2-PyLecture4 -Python Basics2-
PyLecture4 -Python Basics2-
 
PyLecture2 -NetworkX-
PyLecture2 -NetworkX-PyLecture2 -NetworkX-
PyLecture2 -NetworkX-
 
PyLecture1 -Python Basics-
PyLecture1 -Python Basics-PyLecture1 -Python Basics-
PyLecture1 -Python Basics-
 
PyLecture3 -json-
PyLecture3 -json-PyLecture3 -json-
PyLecture3 -json-
 

Kürzlich hochgeladen

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 

Kürzlich hochgeladen (20)

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 

Py lecture5 python plots

  • 1.
  • 2.  python 2D plotting library which produces publication quality figures in › a variety of hardcopy formats › interactive environments
  • 3. import matplotlib.pyplot as plt # x data, y data, style plt.plot([1,2,3,4], [5,6,7,8], 'r-') # [x min, x max, y min, y max] plt.axis([0, 5, 0, 9]) plt.ylabel('some numbers') plt.show()
  • 4.
  • 5.  Draw the graph(y = x^2).
  • 6. x = range(100) y = [i * i for i in x] plt.plot(x, y, 'r-') plt.ylabel('y = x^2') plt.show()
  • 7. import matplotlib.pyplot as plt data = [2, 7, 6, 4, 1, 10, 3, 2, 4, 5, 3, 1] plt.hist(data, bins=8, facecolor='blue') plt.show()
  • 8.
  • 9. import matplotlib.pyplot as plt # The slices will be ordered and plotted counter-clockwise. labels = 'Fuji', 'Tsugaru', 'Orin', 'Jonagold', 'Other' sizes = [235500, 50600, 47100, 45700, 89100] colors = ['orangered', 'red', 'greenyellow', 'orangered', 'gold'] explode = (0, 0, 0.1, 0, 0) # only "explode" the 3rd slice (i.e. 'Orin') plt.pie(sizes, explode=explode, labels=labels, colors=colors, autopct='%1.1f%%', shadow=True, startangle=90, counterclock=False) # Set aspect ratio to be equal so that pie is drawn as a circle. plt.axis('equal') plt.show()
  • 10.
  • 11. import numpy as np # use numpy import matplotlib.pyplot as plt x = np.array(range(10)) # red line plt.plot(x, x, ls='-', c='red') # blue circles plt.plot(x, x**1.25, ls='', c='blue', marker='o') # green stars plt.plot(x, x**1.5, ls='', c='green', marker='*') plt.show()
  • 12.
  • 13.  For more properties, do › lines=plt.plot([1, 2, 3]) › plt.setp(lines)
  • 14. import numpy as np import matplotlib.pyplot as plt x = np.array(range(10)) # first figure plt.figure(1) # num of row, num of column, num of axis plt.subplot(2, 3, 1) plt.plot(x, x, 'r') plt.subplot(2, 3, 2) plt.plot(x, x, 'bo') plt.show()
  • 15.
  • 16. import numpy as np import matplotlib.pyplot as plt x = np.arange(0, 1, 0.001) y = x**1.5 plt.plot(x, y, 'r') plt.xlabel(r'$x$') plt.ylabel(r'$y=x^{1.5}$') plt.title(r'Graph of $y=x^{1.5}$') plt.text(0.3, 0.25, r'$y=x^{1.5}$') plt.grid(True) plt.show()
  • 17.
  • 18.  Draw the graph of binary entropy function 𝐻 𝑝 = −𝑝log2 𝑝 − 1 − 𝑝 log2 1 − 𝑝 › Hint: use np.log2 to calculate log2
  • 19. import numpy as np import matplotlib.pyplot as plt p = np.arange(0, 1, 0.001) H = -p*np.log2(p) - (1-p)*np.log2(1-p) plt.plot(p, H, 'r') plt.xlabel(r'$p$') plt.ylabel(r'$H(p)=-p ¥log_{2}(p)-(1-p)¥log_{2}(1-p)$') plt.title('Binary Entropy Function') plt.grid(True) plt.show()
  • 20.  Matplotlib tutorial http://matplotlib.org/users/pyplot_tutorial.html  りんご大学 - 品種別生産量の推移 http://www.ringodaigaku.com/study/statistics/ production_kind.html