通过plt.subplot能够在一张图中画出多个子图 #coding: utf-8 #!/usr/bin/env python """ Draw a graph with matplotlib. You must have matplotlib for this to work. """ __author__ = """Aric Hagberg (hagberg@lanl.gov)"""
在讲解绘制多个子图之前先简单了解一下使用matplotlib绘制一个图,导入绘图所需库matplotlib并创建一个等间隔的列表x,将[0,2*pi]等分为50等份,绘制函数sin(x).当没有给定x轴数值时,默认以下标作为x的值,如果x值确定,则绘图时写为 plt.plot(x,y) . 如若想要绘制一个图时写入标签,则写为 plt.plot(x,y,label="figure1"). from numpy import * import matplotlib.pyplot as p