Find x-y axis boundaries encompassing a list of TH1s if the bounds are not given in arguments.
Arguments:
th1s -- List of TH1s
ylog -- Boolean indicating if y axis is in log scale or not (affects the automatic ymax)
Keyword arguments:
xmin -- Minimum x value; if None, take the minimum of TH1s
xmax -- Maximum x value; if None, take the maximum of TH1s
xmin -- Minimum y value; if None, take the minimum of TH1s
xmax -- Maximum y value; if None, take the maximum of TH1s
Definition at line 71 of file plotting.py.
References _getXmax(), _getXmin(), _getYmax(), _getYmin(), _getYminIgnoreOutlier(), alcazmumu_cfi.filter, bookConverter.max, and min().
Referenced by plotting.Plot.draw().
72 def _findBounds(th1s, ylog, xmin=None, xmax=None, ymin=None, ymax=None):
73 """Find x-y axis boundaries encompassing a list of TH1s if the bounds are not given in arguments.
77 ylog -- Boolean indicating if y axis is in log scale or not (affects the automatic ymax)
80 xmin -- Minimum x value; if None, take the minimum of TH1s
81 xmax -- Maximum x value; if None, take the maximum of TH1s
82 xmin -- Minimum y value; if None, take the minimum of TH1s
83 xmax -- Maximum y value; if None, take the maximum of TH1s
95 if xmin
is None or xmax
is None or ymin
is None or ymax
is None or isinstance(ymin, list)
or isinstance(ymax, list):
103 if ylog
and isinstance(ymin, list):
116 elif isinstance(ymin, list):
117 ym_unscaled =
min(ymins)
118 ym = y_scale_min(ym_unscaled)
119 ymins_below =
filter(
lambda y: y<=ym, ymin)
120 if len(ymins_below) == 0:
122 if ym_unscaled < ymin:
123 print "Histogram minimum y %f is below all given ymin values %s, using the smallest one" % (ym, str(ymin))
125 ymin =
max(ymins_below)
128 ymax = y_scale_max(
max(ymaxs))
129 elif isinstance(ymax, list):
130 ym_unscaled =
max(ymaxs)
131 ym = y_scale_max(ym_unscaled)
132 ymaxs_above =
filter(
lambda y: y>ym, ymax)
133 if len(ymaxs_above) == 0:
135 if ym_unscaled > ymax:
136 print "Histogram maximum y %f is above all given ymax values %s, using the maximum one" % (ym_unscaled, str(ymax))
138 ymax =
min(ymaxs_above)
142 th1.GetXaxis().SetRangeUser(xmin, xmax)
143 th1.GetYaxis().SetRangeUser(ymin, ymax)
145 return (xmin, ymin, xmax, ymax)
def _getYminIgnoreOutlier