Lecturer: Mubdi Rahman

4. BASIC PLOTTING

JHU Physics & Astronomy Python Workshop 2017

Lecturer: Mubdi Rahman

INTRODUCING MATPLOTLIB!

Very powerful plotting package. The Docs:

GETTING STARTED WITH MATPLOTLIB

Matplotlib has multiple ways of interfacing with it, as well as a large number of additional modules and patches that extend its capabilities significantly. The main interface we'll be using for this work is the pyplot interface:

import matplotlib.pyplot as plt

You can choose to run matplotlib either interactively or noninteractively. For the interactive mode, the plot gets updated as you go along. For non-interactive, the plot doesn't show up until you've finished everything. To switch between the two:

plt.ion() # Turn interactive mode on plt.ioff() # Turn interactive mode off plt.show() # Show the plot when interactive mode off

GETTING STARTED WITH MATPLOTLIB

Matplotlib has multiple ways of interfacing with it, as well as a large number of additional modules and patches that extend its capabilities significantly. The main interface we'll be using for this work is the pyplot interface:

import matplotlib.pyplot as plt

You can choose to run matplotlib either interactively or noninteractively. For the interactive mode, the plot gets updated as you go along. For non-interactive, the plot doesn't show up until you've finished everything. To switch betweIesntatrhteedtwusoin: g python back in the "Wild

West" days. Some of the defaults of how I plt.ion() # Turn interactivceodmeoadreenootnthe standards suggested plt.ioff() # Turn interactitvodeaym. oIndpearotifcuflar, I import plt.show() # Show the plot mwahtepnlotliibn.ptyeprloatcatsipv. eCamll omdeeonotfhifs!

GETTING STARTED WITH MATPLOTLIB

Matplotlib has multiple ways of interfacing with it, as well as a large number of additional modules and patches that extend its capabilities significantly. The main interface we'll be using for this work is the pyplot interface:

import matplotlib.pyplot as plt

If you are in a situation where you can't

You can choose to run matplotlib editishpelraiyntaerpalcottivoerlydoonr'tnhoanv-e the ability

interactively. For the interactive m(io.ed.e, ,ssthhe-inpglowt igtheotsutuXpfdoartweadrdaisngyo, urunning

go along. For non-interactive, finished everything. To switch

btheetwpoenloeatndtwhoeeebstnswe'tors:vheorw),

dupo

tuhnetilfoylolouw'vieng

before

importing pyplot:

plt.ion() # Turn interactive mode on

plt.ioff() # Turn interactiimvpeormtodemaotfpflotlib

plt.show() # Show the plotmawthpelnotinltiebr.aucstei(v`eAmgogd'e) off

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download

To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

Literature Lottery