第一次使用python的matplotlib作图,其中还使用了numpy和scipy
# -*- coding: utf-8 -*-
"""
Spyder Editor
This temporary script file is located here:
C:\Documents and Settings\Administrator\.spyder2\.temp.py
"""
import numpy as np
import scipy as sp
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rcParams['axes.unicode_minus'] = False
fig = plt.figure()
ax = fig.add_subplot(1,2,1)
ax.plot(10*np.random.randn(100), 10*np.random.randn(100), '.')
ax.set_title('Using hypen instead of unicode minus')
ax=fig.add_subplot(1,2,2)
x=np.linspace(0,4*np.pi,100)
ax.plot(x,sp.sin(x))
plt.show()
得到的如下图所示: