def plotKey(data, name, key): ## plot the cluster rmsd dist. plot = biggles.FramedPlot() plot.add(biggles.PlotLabel(0.5, 0.90, name, size=4)) ## customize plot appearence #plot.x1.label = 'cluster' plot.y2.label = 'size' plot.y1.label = key plot.x2.draw_ticks = 0 plot.y2.draw_ticks = 0 ## Plot plot.add( biggles.ErrorBarsY(clst_range, data[key][1], data[key][2], width=1)) plot.add(biggles.Points(clst_range, data[key][0], type='cross', size=1)) plot.add(biggles.LineY(0.25, type='dot')) ## add label with info about 'good' solutions good = [] for clst in clst_range: if data[key][0][clst - 1] > 0.25: good += [clst] plot.add(biggles.PlotLabel(0.5, 0.80, str(good), size=1)) return plot
def plot(complex_lst): ## plot the cluster rmsd dist. plot = biggles.FramedPlot() inset = biggles.FramedPlot() ## plot title plot.title = '/'.join(string.split(absfile(options['o']), '/')[-5:-1]) ## customize plot appearence plot.x1.label = 'cluster' plot.y2.label = 'size' plot.y1.label = 'rmsd' plot.x2.draw_ticks = 0 plot.y2.draw_ticks = 0 inset.frame.draw_ticks = 0 inset.x1.draw_ticklabels = 0 inset.y1.draw_ticklabels = 0 inset.y2.draw_ticklabels = 1 inset.y2.draw_ticks = 1 inset.y2.ticks_style['color'] = 'red' ## get cluter and rmsd lists clst_list = [] rms_list = [] for compl in complex_lst: clst_list += [compl.info['hex_clst']] rms_list += [compl.info['rms']] ## get average, max, min and size of cluster data = [] clst_range = range(1, max(clst_list) + 1) for clst in clst_range: rms = compress(equal(clst_list, clst), rms_list) data += [[average(rms), max(rms), min(rms), len(rms)]] data = transpose(data) ## Inset inset.add(biggles.Curve(clst_range, data[3], color='red')) ## Plot plot.add(biggles.ErrorBarsY(clst_range, data[1], data[2])) plot.add(biggles.Points(clst_range, data[0], type='cross', size=1)) plot.add(biggles.Inset((0.0, 0.0), (1.0, 1.0), inset)) plot.add(biggles.LineY(10, type='dot')) ## add label with info about 'good' solutions (average rmsd < 10A) good = [] for clst in clst_range: if data[0][clst - 1] < 10: good += [clst] plot.add(biggles.PlotLabel(0.5, 0.98, 'Solutions with rmsd < 10A', size=1)) plot.add(biggles.PlotLabel(0.5, 0.95, str(good), size=1)) ## plot and save plot.show() plot.write_eps(string.split(options['o'], '.')[0] + '.eps')
def add_log_error_bars(plt, axis, x, y, err, prange, **keys): from .biggles import ErrorBarsX, ErrorBarsY if axis == 'x': low = x - err high = x + err else: low = y - err high = y + err w, = numpy.where(high > 0) if w.size > 0: high = high[w] # outside range to avoid seeing hat low = low[w].clip(0.5 * prange[0], 2.0 * max(max(high), prange[1])) if axis == 'x': p = biggles.ErrorBarsX(y[w], low, high, **keys) else: p = biggles.ErrorBarsY(x[w], low, high, **keys) plt.add(p) return p
def add_log_error_bars(plt, type, x, y, err, prange, **pkeywords): import biggles if type == 'x': low = x - err high = x + err else: low = y - err high = y + err w, = where(high > 0) if w.size > 0: high = high[w] # outside range to avoid seeing hat low = low[w].clip(0.5 * prange[0], 2.0 * max(max(high), prange[1])) if type == 'x': p = biggles.ErrorBarsX(y[w], low, high, **pkeywords) else: p = biggles.ErrorBarsY(x[w], low, high, **pkeywords) plt.add(p) return p
"jan16", "jan30", "feb06", "feb13", "feb20", "feb27", "mar06", "mar13", "apr08", "apr09", "apr10" ] y = y / sqrt(2.) ye1 = ye1 / sqrt(2.) ye2 = ye2 / sqrt(2.) tell_me_about_it(9460.3) y = y / (9460.3 / 2.) * 1.e6 ye1 = ye1 / (9460.3 / 2.) * 1.e6 ye2 = ye2 / (9460.3 / 2.) * 1.e6 p[0, 0] = biggles.FramedPlot() p[0, 0].add(biggles.Points(x, y, symboltype="filled circle", symbolsize=1.5)) p[0, 0].add(biggles.ErrorBarsY(x, y - ye1, y + ye2)) p[0, 0].add( biggles.LineY(3.78739 / sqrt(2.) / (9460.3 / 2.) * 1.e6, linetype="dashed")) p[0, 0].x.ticks = x p[0, 0].x.ticklabels = names p[0, 0].x2.draw_ticklabels = 0 p[0, 0].x.draw_subticks = 0 p[0, 0].aspect_ratio = 0.3 p[0, 0].yrange = 400., 700. p[0, 0].y1.label = r"$\Upsilon(1S)$ $\sigma_E/E$ $\times$ 10$^{6}$ in MeV" p[0, 0].show() x = range(6) y = Numeric.array([ 4.28629322679, 4.01314654533, 4.25415201809, 3.91987316377, 3.7696777093,