MatPlotLib - University of Massachusetts Amherst
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
- 5 introduction to matplotlib
- matplotlib university of massachusetts amherst
- python for data science cheat sheet plot anatomy
- matplotlib tutorialspoint
- basic plotting with python and matplotlib
- matplotlib 2d and 3d plotting in python
- scientific plotting with matplotlib sersol
- lab 5 introduction to matplotlib
- chapter plotting data using 4 matplotlib
Related searches
- cil realty of massachusetts inc
- commonwealth of massachusetts phone number
- university of massachusetts amherst online
- state of massachusetts withholding
- list of massachusetts dispensaries
- commonwealth of massachusetts address
- commonwealth of massachusetts dpu
- university of massachusetts online classes
- university of massachusetts online programs
- commonwealth of massachusetts boston ma
- commonwealth of massachusetts long form
- commonwealth of massachusetts insurance