(Assignment 2) First iPython Assignment for MPO 624

To start, let's just try a plot for a random idea of mine. Let's import all of our necessary variables.

In [1]:
%pylab inline
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
Populating the interactive namespace from numpy and matplotlib
In [2]:
plt.xkcd()
plt.plot([1,2,3,4,5,6,7,8,9,10], [14,7,12,8,10,3,1,9,6,6], 'ro')
    # Races: Chicago, Loudon, Dover, Charlotte, Kansas, Talladega, Martinsville, Texas, Phoenix, Homestead-Miami 
plt.axis([0,11,0,43])
plt.gca().invert_yaxis() #We want to invert Y to show 1st place at the top of the plot and 43rd at the bottom.

plt.xlabel('Race number in The Chase')
plt.ylabel('Final Position')
plt.title('Jeff Gordon Finishing Positions in the 2015 Chase for the Sprint Cup')
plt.show()

Okay, enough fun with this kind of stuff. Now, let's move to plotting something scientific looking.

In [3]:
x = np.linspace(0, 10)
y1 = x * np.sin(x)*10
y2 = x * np.cos(x)*10

plt.fill(x, y1, 'orange', alpha=0.9)
plt.fill(x, y2, 'green', alpha=0.25)
plt.xlabel('Level of Bravery')
plt.ylabel("Coaster Slope Gradient (m)")
plt.title('The Dueling Rollercoasters')
Out[3]:
<matplotlib.text.Text at 0x106662d90>

These are some of the cool things one can do with the Python Notebook.