import matplotlib as mpl |
import numpy as np |
import matplotlib.pyplot as plt |
np.random.seed( 2000 ) |
date = np.random.standard_normal(( 20 , 2 )) |
y = date.cumsum(axis = 0 ) |
y[:, 0 ] = y[:, 0 ] * 100 |
plt.figure(figsize = ( 7 , 5 )) # 确定图片大小 |
plt.subplot( 211 ) # 确定第一个图的位置 (行,列,第几个)两行一列第一个图 |
plt.plot(y[:, 0 ], 'b' ,label = "1st" ) |
plt.plot(y[:, 0 ], 'ro' ) |
plt.grid( True ) |
plt.axis( 'tight' ) |
plt.xlabel( "Index" ) |
plt.ylabel( 'Values of 1st' ) |
plt.title( "This is double axis label" ) |
plt.legend(loc = 0 ) |
plt.subplot( 212 ) # 确定第一个图的位置 |
plt.plot(y[:, 1 ], 'g' ,label = "2st" ) |
plt.plot(y[:, 1 ], 'r*' ) |
plt.ylabel( "Values of 2st" ) |
plt.legend(loc = 0 ) |
plt.show() |