55import matplotlib .mlab as _mlab
66import numpy as _np
77import funclib .baselib as _baselib
8+ from plotlib .mplfuncs import FigWidthsInch as sizes
89#import scipy.stats as _stats
910#import math as _math
1011
12+ SIZE = (sizes .two_col .value , sizes .two_col .value )
1113
12- def histo (data , bins = 'auto' , normed = True , show = True ):
14+
15+ def histo (data , bins = 'auto' , normed = True , show = True , figsize = None ):
1316 '''(list|ndarray, str|int, bool
1417 Plot a histogram
1518 '''
1619
1720 D = _np .array (data ).flatten ()
21+
22+ global SIZE
23+ if figsize :
24+ SIZE = figsize
25+
26+ Plot .figure (figsize = SIZE )
1827 dummy , bins , dummy1 = Plot .hist (D , bins = bins , normed = normed )
1928
2029 if normed :
@@ -27,7 +36,7 @@ def histo(data, bins='auto', normed=True, show=True):
2736 Plot .show ()
2837
2938
30- def scatter (x_data , y_data , data_labels = (), group_labels = (), ptsizes = 4 , data_label_font_sz = 8 , xlim = None , ylim = None , show = True ):
39+ def scatter (x_data , y_data , data_labels = (), group_labels = (), ptsizes = 4 , data_label_font_sz = 8 , xlim = None , ylim = None , show = True , figsize = None ):
3140 '''(list|tuple|ndarray, list|tuple|ndarray|None,
3241 list|tuple|ndarray, list|tuple|ndarray,
3342 2-tuple|None, 2-tuple|None, bool) - void
@@ -62,6 +71,8 @@ def scatter(x_data, y_data, data_labels=(), group_labels=(), ptsizes=4, data_lab
6271 2-Tuple, lower and upper limits of y, or None
6372 show:
6473 show the plot
74+ figsize:
75+ 2-tuple (w,h) in inches, defaults to qplot.SIZE if None, also set global value
6576
6677 Example:
6778 >>>x_data=[[-1,-2,-3],[3,4,5]]
@@ -121,7 +132,11 @@ def scatter(x_data, y_data, data_labels=(), group_labels=(), ptsizes=4, data_lab
121132 else :
122133 ndY = _np .asarray (y_data [ind ]).flatten ()
123134
124- Plot .figure ()
135+ global SIZE
136+ if figsize :
137+ SIZE = figsize
138+
139+ Plot .figure (figsize = SIZE )
125140 Plot .scatter (ndX , ndY , s = ptsizes )
126141
127142 axes = Plot .gca ()
0 commit comments