From 27487606f86f889fc16f434b784c7a508adfbff0 Mon Sep 17 00:00:00 2001 From: Tobias Schmidt <tobias.schmidt@unibas.ch> Date: Wed, 11 Jan 2012 12:02:35 +0100 Subject: [PATCH] modify table plotting function - show legend if specified - allow setting of y_range when plotting only 1D data - allow setting of x and y axis labels when plotting only 1D data - allow setting an empty string as title --- modules/base/pymod/table.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/base/pymod/table.py b/modules/base/pymod/table.py index a050bf624..872156040 100644 --- a/modules/base/pymod/table.py +++ b/modules/base/pymod/table.py @@ -670,7 +670,7 @@ class Table(object): xs = [] ys = [] zs = [] - + if clear: plt.figure(figsize=[8, 6]) @@ -760,7 +760,7 @@ class Table(object): plt.xticks(np.arange(0, len(xs), interval), label_vals, rotation=45, size='x-small') - if not title: + if title==None: if nice_z: title = '%s of %s vs. %s' % (nice_z, nice_x, nice_y) elif nice_y: @@ -770,6 +770,10 @@ class Table(object): plt.title(title, size='x-large', fontweight='bold', verticalalignment='bottom') + + if legend: + plt.legend(loc=0) + if x and y: plt.xlabel(nice_x, size='x-large') if x_range: @@ -781,7 +785,11 @@ class Table(object): plt.ylabel(nice_y, size='x-large') else: - plt.ylabel(nice_x, size='x-large') + if y_range: + plt.ylim(y_range[0], y_range[1]) + if x_title: + plt.xlabel(x_title, size='x-large') + plt.ylabel(nice_y, size='x-large') if save: plt.savefig(save) return plt -- GitLab