MatPlotLib - UMass
MatPlotLib
Computational Physics Matplotlib
Outline
Using Matplotlib and PyPlot
Matplotlib and PyPlot Interactive Plotting Plot method Labels Multiple Figures and Curves
First Steps with Programming
Goals Structure Comments and Documentation
Matplotlib and PyPlot
Matplotlib is a library for 2D plotting.
Can be used in scripts or interactively
Uses NumPy arrays
PyPlot is a collection of methods within Matplotlib which allow user to construct 2D plots easily and interactively
PyPlot essentially reproduces plotting functions and behavior of MATLAB.
To use matplotlib with ipython on our computers:
ipython --matplotlib qt
Importing PyPlot
We import PyPlot as we do other packages:
import matplotlib.pyplot as pl
Remember that pl above is just a shorthand for matplotlib.pyplot. This way, we can invoke PyPlot's methods easily:
pl.plot(X,Y)
In the following slides I will show PyPlot methods with the pl shorthand....
Make your First PLot
imimppoorrttnnuummppyyaassnnpp imimppoorrttmmaattpplolottlilbib.p.pyypplolottaassppll ##mmaakkeeaannuummppyyaarrrraayy XX==nnpp.l.ilninssppaaccee(0(0.,.1,100.,.1,111)) YY==XX**XX ##YYaarrrraayyisisXXssqquuaarreedd ppl.li.oionn()() ##ttuurrnnssoonninintteerraaccttiviveepplolottttiningg ppl.lp.plolott(X(X,Y,Y,',b'boo:':)')##pplolottsslalarrggeebblulueeddoottss
##ccoonnnneecctteeddbbyyddootttteeddlilnineess ppl.lx.xlalabbeel(l'(X'X')') ppl.ly.ylalabbeel(l'(Y'Y')') ppl.lt.tititlele('(M'MyyFFirirssttPPlolott')') ppl.la.axxisis([(-[-11,1,111,-,-11,1,10011])]) ##sseettsstthheeddimimeennssioionnss ppl.lg.grridid()() ##ddrraawwssddootttteeddlilnineessoonnmmaajjoorr""tticickkss""
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- 6 advanced plotting mubdi rahman
- matplotlib umass
- axis label options — options for specifying axis labels stata
- matplotlib — visualization with python
- basic plotting with python and matplotlib massachusetts institute of
- matplotlib for intermediate users
- matplotlib 2d and 3d plotting in python peter beerli
- sas graph elements you should know even if you don t use sas graph
- matplotlib quick reference matti pastell
- matplotlib 2d and 3d plotting in python
Related searches
- umass online courses spring 2019
- umass boston online course
- online courses umass amherst
- umass amherst summer online courses
- umass online degrees
- umass course list
- umass course catalog spring 2020
- umass amherst online courses
- umass online classes
- umass boston online degree programs
- umass amherst summer session 2020
- umass memorial medical center jobs