[enhancement] adding a save option for plotting

This commit is contained in:
sebastianp 2016-08-10 10:06:34 +02:00
parent 37ed561f73
commit 14c22d73b7

View File

@ -424,7 +424,8 @@ class PDFstatistics(object):
def histplot(self, array, binlist, xlab = 'Values', def histplot(self, array, binlist, xlab = 'Values',
ylab = 'Frequency', title = None, label=None): ylab = 'Frequency', title = None, label=None,
fnout = None):
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
plt.hist(array,bins = binlist) plt.hist(array,bins = binlist)
plt.xlabel('Values') plt.xlabel('Values')
@ -434,7 +435,10 @@ class PDFstatistics(object):
if label: if label:
title_str += ' (' + label + ')' title_str += ' (' + label + ')'
plt.title(title_str) plt.title(title_str)
plt.show() if fnout:
plt.savefig(fnout+'histplot.png')
else:
plt.show()
def getPDFDict(self, month, evt): def getPDFDict(self, month, evt):