โมดูลการวางแผน
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()
ฉันต้องการบันทึกกราฟ plot1, plot2, plot3 ทั้งหมดเป็นไฟล์ PDF ไฟล์เดียว มีวิธีใดบ้างที่จะบรรลุ? ฉันไม่สามารถรวมplotGraphฟังก์ชันในโมดูลหลักได้
มีฟังก์ชันที่ตั้งชื่อpylab.savefigแต่ดูเหมือนว่าจะใช้งานได้ก็ต่อเมื่อวางไว้พร้อมกับโมดูลการวางแผน มีวิธีอื่นอีกไหมที่จะทำให้สำเร็จ?