MeteoInfoLab脚本示例:subplot

subplot命令可以自动等间距分配多个坐标系(Axes),命令中有三个参数,前两个定义了行数和列数,第三个指定了当前的坐标系(Axes),绘图命令是作用在当前坐标系中的。

脚本程序:

def f(t):
    return exp(-t) * cos(2*pi*t)

t1 = arange(0., 5., 0.1)
t2 = arange(0., 5., 0.02)

subplot(2,1,1)
plot(t1, f(t1), 'bo', t2, f(t2), 'k')

subplot(2,1,2)
plot(t2, cos(2*pi*t2), 'r--')
show()
原文地址:https://www.cnblogs.com/yaqiang/p/4586252.html