From f8807a7ea68b64ee5db5ab808d80c40ba88a0a9a Mon Sep 17 00:00:00 2001 From: Sebastianw Wehling-Benatelli Date: Wed, 11 May 2016 09:49:19 +0200 Subject: [PATCH] [edit] docstring added and returning the figure instead of showing the plot additionally hide_labels is now defined only once before going into the loop --- pylot/core/pick/compare.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pylot/core/pick/compare.py b/pylot/core/pick/compare.py index 2be4d7aa..1a828c2a 100644 --- a/pylot/core/pick/compare.py +++ b/pylot/core/pick/compare.py @@ -269,6 +269,13 @@ class PDFDictionary(object): return pdf_picks def plot(self, stations=None): + ''' + plots the all probability density function for either desired STATIONS + or all available date + :param stations: list of stations to be plotted + :type stations: list + :return: matplotlib figure object containing the plot + ''' assert stations is not None or not isinstance(stations, list), \ 'parameter stations should be a list not {0}'.format(type(stations)) if not stations: @@ -279,12 +286,12 @@ class PDFDictionary(object): istations = range(nstations) fig, axarr = plt.subplots(nstations, 2, sharex='col', sharey='row') + hide_labels = True for n in istations: station = stations[n] pdfs = self.pdf_data[station] for l, phase in enumerate(pdfs.keys()): - hide_labels = True try: axarr[n, l].plot(pdfs[phase].axis, pdfs[phase].data) if n is 0: @@ -314,4 +321,4 @@ class PDFDictionary(object): plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False) plt.setp([a.get_yticklabels() for a in axarr[:, 0]], visible=False) - plt.show() + return fig