Plotmodul
def plotGraph(X,Y):
fignum = random.randint(0,sys.maxint)
plt.figure(fignum)
### Plotting arrangements ###
return fignum
Hauptmodul
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()
Ich möchte alle Diagramme plot1, plot2, plot3 in einer einzigen PDF-Datei speichern. Gibt es eine Möglichkeit, dies zu erreichen? Ich kann die plotGraphFunktion nicht in das Hauptmodul aufnehmen.
Es gibt eine Funktion namens pylab.savefig, die jedoch nur zu funktionieren scheint, wenn sie zusammen mit dem Plotmodul platziert wird. Gibt es eine andere Möglichkeit, dies zu erreichen?