标签:
1. 基本使用
#!/usr/bin/env python # coding=utf-8 import matplotlib.pyplot as plt from numpy.random import randn # example 1 fig = plt.figure() ax1 = fig.add_subplot(221) ax2 = fig.add_subplot(222) ax1.plot(randn(100).cumsum(),‘r--‘) ax2.hist(randn(100),bins=20,color=‘g‘,alpha=0.3) plt.show() # example 2 fig,axes = plt.subplots(2,2) for i in range(2): for j in range(2): axes[i,j].hist(randn(50),bins=20,color=‘b‘,alpha=.5) plt.show()
标签:
原文地址:http://www.cnblogs.com/jkmiao/p/4607072.html