相关疑难解决方法(0)

将图表保存为PDF

绘图模块

def plotGraph(X,Y):
    fignum = random.randint(0,sys.maxint)
    plt.figure(fignum)
    ### Plotting arrangements ###
    return fignum
Run Code Online (Sandbox Code Playgroud)

主要模块

import matplotlib.pyplot as plt
### tempDLStats, tempDLlabels are the argument
plot1 = plotGraph(tempDLstats, tempDLlabels)
plot2 = plotGraph(tempDLstats_1, tempDLlabels_1)
plot3 = plotGraph(tempDLstats_2, tempDLlabels_2)
plt.show()
Run Code Online (Sandbox Code Playgroud)

我想将所有图形plot1,plot2,plot3保存到单个PDF文件中.有没有办法实现它?我不能plotGraph在主模块中包含该功能.

有一个名为的功能,pylab.savefig但只有当它与绘图模块一起放置时才会起作用.有没有其他方法可以实现它?

python matplotlib

72
推荐指数
4
解决办法
18万
查看次数

标签 统计

matplotlib ×1

python ×1