Matplotlib

Python

Olmo S. Zavala Romero

Today shortcuts

Matplotlib Matplotlib Subfigures Style Limits Titles Shortcuts2 Labels Annotations Saving Plot Types

Matplotlib

Olmo S. Zavala Romero

Center of Atmospheric Sciences, UNAM

September 1, 2016

Today shortcuts

Python

Olmo S. Zavala Romero

Today shortcuts

Matplotlib Matplotlib Subfigures Style Limits Titles Shortcuts2 Labels Annotations Saving Plot Types

These shortcuts work in command mode. A insert cell above. B insert cell bellow. M set current cell as markdown Y set current cell as code

Hello World Matplotlib

Python

Olmo S. Zavala Romero

Today shortcuts

Matplotlib Matplotlib Subfigures Style Limits Titles Shortcuts2 Labels Annotations Saving Plot Types

# This is one of the simplest examples to use matplotlib %matplotlib inline import matplotlib.pyplot as plt import math

x = range(0,100) y = [i for i in x]

plt.plot(x,y) plt.show()

Hello World Matplotlib

Python

Olmo S. Zavala Romero

Today shortcuts

Matplotlib Matplotlib Subfigures Style Limits Titles Shortcuts2 Labels Annotations Saving Plot Types

Exercise: make a function that receives m, b and plots y = mx + b

# This is one of the simplest examples to use matplotlib %matplotlib inline import matplotlib.pyplot as plt import math

x = range(0,100) y = [i for i in x]

plt.plot(x,y) plt.show()

Subfigures

Python

Olmo S. Zavala Romero

Today shortcuts

Matplotlib Matplotlib Subfigures Style Limits Titles Shortcuts2 Labels Annotations Saving Plot Types

To create figures we use figure To define subfigures we use fig.add subplot(rows,cols,indx)

x = range(0,100) y1 = [a for a in x] y2 = [2*a for a in x]

fig = plt.figure( fig.add_subplot(1,2,1) plt.plot(x,y1) fig.add_subplot(1,2,2) plt.plot(x,y2)

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

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

Google Online Preview   Download