最佳答案
def plotGraph(X,Y):
fignum = random.randint(0,sys.maxint)
plt.figure(fignum)
### Plotting arrangements ###
return fignum
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()
I want to save all the graphs plot1, plot2, plot3 to a single PDF file. Is there any way to achieve it? I can't include the plotGraph
function in the main module.
There's a function named pyplot.savefig
but that seems to work only with a single figure. Is there any other way to accomplish it?