From 2f3da81032b03f943b79a4eb064ea5fa1ff005a1 Mon Sep 17 00:00:00 2001 From: Marco Biasini <mvbiasini@gmail.com> Date: Wed, 25 Jul 2012 08:48:06 +0200 Subject: [PATCH] add y_range to PlotHistogram --- modules/base/pymod/table.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/base/pymod/table.py b/modules/base/pymod/table.py index 81e5b5f46..8af2ab6cc 100644 --- a/modules/base/pymod/table.py +++ b/modules/base/pymod/table.py @@ -1143,7 +1143,7 @@ class Table(object): def PlotHistogram(self, col, x_range=None, num_bins=10, normed=False, histtype='stepfilled', align='mid', x_title=None, y_title=None, title=None, clear=True, save=False, - color=None): + color=None, y_range=None): """ Create a histogram of the data in col for the range *x_range*, split into *num_bins* bins and plot it using Matplotlib. @@ -1154,9 +1154,16 @@ class Table(object): :param x_range: start and end value for first dimension (e.g. [start_x, end_x]) :type x_range: :class:`list` of length two + :param y_range: start and end value for second dimension (e.g. [start_y, end_y]) + :type y_range: :class:`list` of length two + :param num_bins: number of bins in range :type num_bins: :class:`int` + :param color: Color to be used for the histogram. If not set, color will be + determined by matplotlib + :type color: :class:`str` + :param normed: normalize histogram :type normed: :class:`bool` @@ -1224,7 +1231,8 @@ class Table(object): else: nice_x=MakeTitle(col) plt.xlabel(nice_x, size='x-large') - + if y_range: + plt.ylim(y_range) if y_title!=None: nice_y=y_title else: -- GitLab