如何使用matplotlib在同一个pdf文件中生成单独的图形?

时间:2017-10-08 16:40:47

标签: python numpy matplotlib

具有所有隶属函数的组合输出,但需要单个pdf文件,每个不同的函数具有不同的输出。

import numpy as np
import skfuzzy as fuzzy
import os

import pylab as pl

x = np.arange(11)



mfx1 = fuzzy.trimf(x, [0, 5, 10])
mfx2 = fuzzy.dsigmf(x, 0, 5, 10, 15)
mfx3 = fuzzy.gauss2mf(x, 0, 5, 10, 15)
mfx4 = fuzzy.gaussmf(x, 0, 5)
mfx5 = fuzzy.gbellmf(x, 1, 5, 10)
mfx6 = fuzzy.pimf(x, 0, 5, 10,15)
mfx7 = fuzzy.psigmf(x, 0, 5, 10, 15)
mfx8 = fuzzy.sigmf(x, 0, 5)
mfx9 = fuzzy.smf(x, 0, 5)
mfx10 = fuzzy.trimf(x, [0, 5, 10])
mfx11 = fuzzy.zmf(x,0, 10)
mfx12 = fuzzy.trapmf(x, [0, 5, 10,15])
mfx13 = fuzzy.piecemf(x,[0, 5, 10])

array = [mfx1,mfx2,mfx3,mfx4,mfx5,mfx6,mfx7,mfx8,mfx9,mfx10,mfx11,mfx12,mfx13]

for m in array:
    print x
    print m
    pl.plot(x,m)
    pl.savefig("a.pdf")
os.startfile("a.pdf")

enter image description here

0 个答案:

没有答案