python notebook,,In[3]:prin


In[3]:
print "hello world"
hello world
In[5]:
for i in range(5):    print i
01234
In[12]:
import matplotlib.pyplot as pltfig = plt.figure()ax1 = fig.add_subplot(2,2,1)plt.show()
技术分享In[11]:
import numpy as npimport matplotlib.pyplot as pltplt.figure(1) # 创建图表1plt.figure(2) # 创建图表2ax1 = plt.subplot(211) # 在图表2中创建子图1ax2 = plt.subplot(212) # 在图表2中创建子图2x = np.linspace(0, 3, 100)for i in xrange(5):    plt.figure(1)  #? # 选择图表1    plt.plot(x, np.exp(i*x/3))    plt.sca(ax1)   #? # 选择图表2的子图1    plt.plot(x, np.sin(i*x))    plt.sca(ax2)  # 选择图表2的子图2    plt.plot(x, np.cos(i*x))plt.show()
技术分享技术分享In[]:

python notebook

评论关闭