new_contents: 
  # coding: utf-8
  
  # In[35]:
  
  get_ipython().magic(u'matplotlib inline')
  from sklearn import datasets
  from sklearn.cross_validation import cross_val_predict
  from sklearn import linear_model
  import matplotlib.pyplot as plt
  
  lr = linear_model.LinearRegression()
  boston = datasets.load_boston()
  y = boston.target
  
  # cross_val_predict returns an array of the same size as `y` where each entry
  # is a prediction obtained by cross validated:
  predicted = cross_val_predict(lr, boston.data, y, cv=10)
  
  fig, ax = plt.subplots()
  ax.scatter(y, predicted)
  ax.plot([y.min(), y.max()], [y.min(), y.max()], 'k--', lw=4)
  ax.set_xlabel('Measured', fontsize=20)
  ax.set_ylabel('Predicted', fontsize=20)
  plt.show()
  
  
  # In[12]:
  
  get_ipython().magic(u'matplotlib inline')
  # import numpy as np
  import matplotlib.pyplot as plt
  
  N = 5
  menMeans = (20, 35, 30, 35, 27)
  menStd =   (2, 3, 4, 1, 2)
  
  ind = np.arange(N)  # the x locations for the groups
  width = 0.35       # the width of the bars
  
  fig, ax = plt.subplots()
  rects1 = ax.bar(ind, menMeans, width, color='r', yerr=menStd)
  
  womenMeans = (25, 32, 34, 20, 25)
  womenStd =   (3, 5, 2, 3, 3)
  rects2 = ax.bar(ind+width, womenMeans, width, color='y', yerr=womenStd)
  
  # add some
  ax.set_ylabel('Scores')
  ax.set_title('Scores by group and gender')
  ax.set_xticks(ind+width)
  ax.set_xticklabels( ('G1', 'G2', 'G3', 'G4', 'G5') )
  
  ax.legend( (rects1[0], rects2[0]), ('Men', 'Women') )
  
  def autolabel(rects):
      # attach some text labels
      for rect in rects:
          height = rect.get_height()
          ax.text(rect.get_x()+rect.get_width()/2., 1.05*height, '%d'%int(height),
                  ha='center', va='bottom')
  
  autolabel(rects1)
  autolabel(rects2)
  
  plt.show()
  
  
  # In[6]:
  
  get_ipython().magic(u'matplotlib inline')
  from pylab import *
  x = np.linspace(0, 5, 10)
  y = x ** 2
  figure()
  
  subplot(1,2,1)
  plot(x, y, 'r--')
  xlabel('x')
  ylabel('y')
  title('title')
  
  subplot(1,2,2)
  plot(y, x, 'g*-')
  xlabel('y')
  ylabel('x')
  title('title')
  show()
  
  
  # In[29]:
  
  get_ipython().magic(u'matplotlib inline')
  import numpy as np
  import matplotlib.pyplot as plt
  x = np.linspace(0, 5, 10)
  y = x ** 2
  y2 = x**3
  
  fig = plt.figure(figsize=(10,8), dpi=100)
  
  axes = fig.add_axes([0.1, 0.1, 0.8, 0.8]) # left, bottom, width, height (range 0 to 1)
  
  axes.plot(x, y, 'r', label="test1")
  axes.plot(x, y2, 'g-*', label="test2")
  axes.legend()
  axes.set_xlabel('x')
  axes.set_ylabel('y')
  axes.set_title('title');
  axes.grid(color='b', alpha=0.5, linestyle='dashed', linewidth=0.5)
  #Scientific notation
  from matplotlib import ticker
  formatter = ticker.ScalarFormatter(useMathText=True)
  formatter.set_scientific(True) 
  formatter.set_powerlimits((-1,1)) 
  axes.yaxis.set_major_formatter(formatter) 
  
  plt.show()
  
  
  # In[31]:
  
  fig = plt.figure()
  ax = fig.add_axes([0.0, 0.0, .6, .6], polar=True)
  t = np.linspace(0, 2 * np.pi, 100)
  ax.plot(t, t, color='blue', lw=3);
  plt.show()
  
  
  # In[38]:
  
  n = np.random.randn(100000)
  fig, axes = plt.subplots(2, 1, figsize=(8,6))
  
  axes[0].hist(n)
  axes[0].set_title("Default histogram", fontsize=20)
  axes[0].set_xlim((min(n), max(n)))
  
  axes[1].hist(n, cumulative=True, bins=50)
  axes[1].set_title("Cumulative detailed histogram", fontsize=20)
  axes[1].set_xlim((min(n), max(n)));
  
  
  # In[46]:
  
  get_ipython().magic(u'matplotlib inline')
  from mpl_toolkits.mplot3d.axes3d import Axes3D
  
  alpha = 0.7
  phi_ext = 2 * np.pi * 0.5
  
  def flux_qubit_potential(phi_m, phi_p):
      return 2 + alpha - 2 * np.cos(phi_p) * np.cos(phi_m) - alpha * np.cos(phi_ext - 2*phi_p)
  phi_m = np.linspace(0, 2*np.pi, 100)
  phi_p = np.linspace(0, 2*np.pi, 100)
  X,Y = np.meshgrid(phi_p, phi_m)
  Z = flux_qubit_potential(X, Y).T
  fig = plt.figure(figsize=(14,6))
  
  fig = plt.figure(figsize=(20, 32), dpi=200)
  # `ax` is a 3D-aware axis instance because of the projection='3d' keyword argument to add_subplot
  ax = fig.add_subplot(2, 1, 1, projection='3d')
  
  p = ax.plot_surface(X, Y, Z, rstride=4, cstride=4, linewidth=0)
  
  # surface_plot with color grading and color bar
  ax = fig.add_subplot(2, 1, 2, projection='3d')
  p = ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=matplotlib.cm.coolwarm, linewidth=0, antialiased=False)
  cb = fig.colorbar(p, shrink=0.5)
  
  
  # In[ ]:
  
  
  
  
subject: add files