当前位置: 首页>>代码示例>>Python>>正文


Python ROOT.TPad类代码示例

本文整理汇总了Python中ROOT.TPad的典型用法代码示例。如果您正苦于以下问题:Python TPad类的具体用法?Python TPad怎么用?Python TPad使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TPad类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: make_empty_canvas

 def make_empty_canvas(self):
     """Instanciate canvas with two pads."""
     # canvas
     self.decoratee.make_empty_canvas()
     if self.no_second_histo:
         return
     name = self.name
     self.main_pad = TPad(
         "main_pad_" + name, 
         "main_pad_" + name, 
         0, 0.25, 1, 1
     )
     # main (upper) pad
     main_pad = self.main_pad
     main_pad.SetTopMargin(0.1)
     main_pad.SetBottomMargin(0.)
     main_pad.SetRightMargin(0.04)
     main_pad.SetLeftMargin(0.16)
     main_pad.Draw()
     # bottom pad
     self.canvas.cd()
     self.second_pad = TPad(
         "bottom_pad_" + name, 
         "bottom_pad_" + name, 
         0, 0, 1, 0.25
     )
     second_pad = self.second_pad
     second_pad.SetTopMargin(0.)
     second_pad.SetBottomMargin(0.375)
     second_pad.SetRightMargin(0.04)
     second_pad.SetLeftMargin(0.16)
     second_pad.SetGridy()
     second_pad.Draw()
开发者ID:TillArndt,项目名称:CmsToolsAC3b,代码行数:33,代码来源:rendering.py

示例2: bookCanvas

    def bookCanvas(self, xSize=1600, ySize=900):
        '''
        @brief book a ROOT TCanvas
        @param xSize: size (in pixels) in the horizontal direction 
        @param ySize: size (in pixels) in the vertical direction

        It is necessary to set self.middlePositions and self.middleSize to 
        the desired values before calling this as it sets up the middle pad
        '''

        if self.middlePositions[0]+self.middleSize[0] > 1:
            raise(ValueError("Inner plot exceeds right boundary!"))
        if self.middlePositions[1]+self.middleSize[1] > 1:
            raise(ValueError("Inner plot exceeds top boundary!"))
        
        self.canvas = TCanvas("TuDoUtils Canvas", "TuDoUtils Canvas", 10, 10, xSize, ySize)



        self.pad1 = TPad("pad1", "pad1", 0, 0, 1, 1, 0, 0, 0)
        self.pad2 = TPad("pad2", "pad2",  self.middlePositions[0], self.middlePositions[1], self.middlePositions[0]+self.middleSize[0], self.middlePositions[1]+self.middleSize[1])

        margin = 0.2
        # self.pad1.SetLeftMargin(margin)
        # self.pad1.SetRightMargin(margin)
        self.pad2.SetLeftMargin(0.15)
        self.pad2.SetBottomMargin(0.2)
        self.xRangeMiddle=self.xRange
开发者ID:yassya,项目名称:TuDoUtils,代码行数:28,代码来源:plotInPlotHolder.py

示例3: bookCanvas

    def bookCanvas(self, xSize=1600, ySize=900):
        '''
        @brief book a ROOT TCanvas
        @param xSize: size (in pixels) in the horizontal direction 
        @param ySize: size (in pixels) in the vertical direction
        '''
        self.canvas = TCanvas("TuDoUtils Canvas", "TuDoUtils Canvas", 10, 10, xSize, ySize)


        upheight=0.75
        dwcorr=1.32
        dwheight=(1-upheight)*dwcorr

        self.pad1 = TPad("pad1", "pad1",0.0,1-upheight,1.0,1.0)
#            self.pad1.SetTopMargin(0.05 * 20. / 13.)
        self.pad1.SetBottomMargin(-0.05)
        self.pad1.SetLeftMargin(0.12)
        self.pad1.SetRightMargin(0.05)#

        self.pad2 = TPad("pad2", "pad2", 0.0,0.0,1.0,dwheight)
        self.pad2.SetGridy(1)
#            self.pad2.SetTopMargin(0)
        self.pad2.SetBottomMargin(0.16*20/7)
        self.pad2.SetLeftMargin(0.12)
        self.pad2.SetRightMargin(0.05)
开发者ID:yassya,项目名称:TuDoUtils,代码行数:25,代码来源:ratioPlotHolder.py

示例4: __init__

    def __init__(self, name, title, lumi, energy, simOnly):
        super(CanvasRatio, self).__init__(name, title)

        self.lumi = lumi
        self.energy = energy
        self.simOnly = simOnly

        bm_ = gStyle.GetPadBottomMargin()  
        tm_ = gStyle.GetPadTopMargin()
        lm_ = gStyle.GetPadLeftMargin()
        rm_ = gStyle.GetPadRightMargin()
  
        self.splitPad = 0.34
        self.cd()
        self.main = TPad("pMain","pMain",
                         0., self.splitPad ,1.,1.)
        
        self.ratio  = TPad("pRatio","pRatio",
                           0., 0. ,1.,self.splitPad)

        self.main.SetLeftMargin(lm_)
        self.main.SetRightMargin(rm_)
        self.main.SetTopMargin(tm_/(1-self.splitPad) )
        self.main.SetBottomMargin(0.02/(1-self.splitPad) )
        
        self.ratio.SetLeftMargin(lm_)
        self.ratio.SetRightMargin(rm_)
        self.ratio.SetTopMargin(0.01/self.splitPad)
        self.ratio.SetBottomMargin(bm_/self.splitPad)
        self.main.Draw()
        # cmsPrel(25000., 8., True, self.splitPad)
        self.ratio.Draw()
开发者ID:GaelTouquet,项目名称:cpyroot,代码行数:32,代码来源:officialstyle.py

示例5: draw_histos

 def draw_histos(self):
     for i in range(self.planes):
         self.histos.append([])
         self.pads.append([])
         self.canvas.cd(i+1)
         name = 'ROC' + str(i)
         p = TPad('name','',0,0,1,1)
         p.SetRightMargin(0.15)
         self.pads[i].append(p)
         p.Draw()
         p.cd()
         th2 = TH2F(name, name, self.data[i].shape[0],
                    0, 53, self.data[i].shape[1], 0, 81)
         th2.SetStats(False)
         th2.SetDirectory(0)
         th2.SetMarkerSize(10)
         th2.GetXaxis().SetTitle('pixels x')
         th2.GetYaxis().SetTitle('pixels y')
         th2.GetYaxis().SetTitleOffset(1.2)
         th2.GetYaxis().CenterTitle()
         th2.GetXaxis().CenterTitle()
         th2.GetZaxis().SetTitle('pulse height')
         th2.GetZaxis().SetTitleOffset(1.2)
         th2.GetZaxis().CenterTitle()
         th2.SetDrawOption('COLZ')
         self.histos[i].append(th2)
         for ix, x in enumerate(self.data[i]):
             for iy, y in enumerate(x):
                 th2.SetBinContent(ix, iy, y)
         th2.Draw('COLZ')
         self.canvas.Update()
开发者ID:michareichmann,项目名称:testing_stuff,代码行数:31,代码来源:errorlog.py

示例6: main

def main():
	f = TFile("ScanXsec.root","recreate")
	c1 = TCanvas( 'c1', 'A Simple Graph', 200, 10, 1600, 900 )
	c1.SetGrid(0,0)
        gStyle.SetPaintTextFormat(".2e")
        gStyle.SetOptStat(0)
	gStyle.SetMarkerSize(0.9)
        hAList30 = gethAList(hA_files30)
	hAList34 = gethAList(hA_files34)
	histo_hA030 = TH2F('xsec1','Xsec(gz=0.8, tb=1.0) pdf setting 263000',17,500,4100,6,250,850)
        histo_hA034 = TH2F('xsec2','Cross-Section(pb) with PDF Setting: 263400(CMS), 263000(ATLAS and containing b quarks) and #DeltaCS',17,500,4100,6,250,850)
	histo_hA0Rate = TH2F('xsec3','Xsec(gz=0.8, tb=1.0) Rate',17,500,4100,6,250,850)

	histo_hA034.SetXTitle("M_{Zp} (GeV)")
	histo_hA034.SetYTitle("M_{A0} (GeV)")

	for a in hAList30:
	    histo_hA030.Fill(a.zpMass,a.ma0Mass,a.weight)
	    for b in hAList34:
                if (a.zpMass==b.zpMass and a.ma0Mass==b.ma0Mass):
	            histo_hA034.Fill(b.zpMass,b.ma0Mass,b.weight)
                    a.rate = a.weight/b.weight
                    b.rate = b.weight/a.weight
	            histo_hA0Rate.Fill(b.zpMass,b.ma0Mass,abs(a.rate-1))

        histo_hA034.SetBarOffset(0.2)
        histo_hA0Rate.SetBarOffset(-0.2)
        histo_hA034.GetYaxis().SetTickLength(0.)
	histo_hA034.Draw("colztext")
	histo_hA030.Draw("textsame")
	histo_hA0Rate.Draw("textsame")
        
        p = TPad("p","p",0.,0.,1.,1.)
        p.SetFillStyle(0)
        p.Draw("same")
        p.cd()
        pt1 = TPaveText(0.574,0.55,0.8,0.75)
        pt2 = TPaveText(0.795,0.55,0.897,0.75)
        pt1.SetTextSize(0.02)
        pt1.AddText("Each bin contains 3 values,")
        pt1.AddText("they are the cross-section (CS)")
        pt1.AddText("with pdf = 263400(CMS), 263000+b(ATLAS)")
        pt1.AddText("and the difference between 2 pdf settings,")
        pt1.AddText(" #DeltaCS = |CS_{CMS} - CS_{ATLAS}|/CS_{CMS}")
        pt2.SetTextSize(0.02)
        pt2.AddText("#scale[1.3]{CS_{CMS}}")
        pt2.AddText("#scale[1.3]{CS_{ATLAS}}")
        pt2.AddText("#scale[1.3]{#DeltaCS}")
        pt2.AddText("( 2% < #DeltaCS < 7% )")
        pt1.Draw()
        pt2.Draw()
        

	c1.SaveAs("pdfDiff.png")
	c1.Print("pdfDiff.pdf")
        f.Write()
	f.Close()
	c1.Update()
开发者ID:shu-xiao,项目名称:gztbDiagram,代码行数:58,代码来源:getXsecTable.py

示例7: make_spectral_plot

def make_spectral_plot(image_name,
                       stack,
                       legend):
    """
    :param image_name: name of output image (ext. ".png" will be added)
    :type image_name: str
    :param stack: stack of histograms to plot
    :type stack: THStack
    :param legend: legend to accompany histograms in stack
    :type legend: TLegend
    """
    ROOT.gROOT.SetStyle("Plain")
    gStyle.SetCanvasBorderMode(0)
    gStyle.SetPadBorderMode(0)
    gStyle.SetPadColor(0)
    gStyle.SetCanvasColor(0)
    gStyle.SetOptTitle(0)
    gStyle.SetLabelSize(0.06, "xyz")
    gStyle.SetTitleSize(0.06, "xyz")
    gStyle.SetOptStat("")
    c1 = TCanvas("canvas", "canvas", 1200, 900)
    c1.cd()
    p1 = TPad("p1", "Region of Interest", 0.0, 0.5, 0.7, 1.0, 0)
    p1.SetBottomMargin(0.15)
    p1.SetLeftMargin(0.15)
    p1.Draw()
    p2 = TPad("p2", "Key", 0.7, 0.5, 1.0, 1.0, 0)
    p2.SetBottomMargin(0.15)
    p2.SetTopMargin(0.15)
    p2.SetLeftMargin(0.05)
    p2.SetRightMargin(0.05)
    p2.Draw()
    p3 = TPad("p3", "Full Spectrum", 0.0, 0.0, 1.0, 0.5, 0)
    p3.SetBottomMargin(0.15)
    p3.SetLeftMargin(0.15)
    p3.Draw()
    p3.cd()
    gStyle.SetOptStat(0)
    p3.SetLogy()
    stack.Draw("nostack")
    stack.GetXaxis().SetTitle("E (MeV)")
    stack.GetYaxis().SetTitle("Events/(0.02 MeV)")
    stack.SetMinimum(0.1)
    p1.cd()
    gStyle.SetOptStat(0)
    p1.SetLogy()
    stack_zoomed = stack.Clone()
    x_axis = stack_zoomed.GetXaxis()
    bin_width = x_axis.GetBinWidth(0) # assume uniform
    e_lo = 2.0 # MeV
    e_hi = 3.5 # MeV
    x_axis.SetRange(int(e_lo/bin_width), int(e_hi/bin_width))
    stack_zoomed.SetMaximum(5e3)
    stack_zoomed.Draw("nostack")
    p2.cd()
    legend.Draw()
    c1.Draw()
    image_path = image_name + ".png"
    c1.Print(image_path)
    raw_input("RETURN to exit")
开发者ID:ashleyrback,项目名称:MajoRat,代码行数:60,代码来源:plots.py

示例8: __init__

    def __init__(self, infos, run_mode, number):
        self.number = number
        self.runmode = run_mode
        self.infos = infos

        if self.infos.single_mode:
            self.c = TCanvas("c", self.canvas_name(), 1500, 1000)
        else:
            self.c = TCanvas("c", self.canvas_name(), 1000, 1000)
        # dividing canvas into pads
        self.p5 = TPad("p5", "", space, space, 1 - space, title / 3 - space / 2)
        self.p6 = TPad("p6", "", space, title / 3 + space / 2, 1 - space, title * 2 / 3 - space / 2)
        self.p7 = TPad("p7", "", space, title * 2 / 3 + space / 2, 1 - space, title - space / 2)
        if number == "1":
            self.p7 = TPad("p7", "", space, space, 1 - space, title - space / 2)
        if number == "2":
            padsize = (title - 2 * space) / 2
            self.p7 = TPad("p7", "", space, 2 * space + padsize, 1 - space, 2 * space + 2 * padsize)
            self.p6 = TPad("p6", "", space, space, 1 - space, space + padsize)
        self.p8 = TPad("p8", "", 0, title, 1, 1)
        self.draw_pads()
        # title texts
        self.t2 = TPaveText(0, 0, 1, 0.7, "NB")
        self.t3 = TPaveText(0.5, 0, 1, 0.7, "NB")
        self.draw_titles()
        # graphs
        self.g1 = {}
        self.g2 = {}
        self.make_graphs()
        # graph pads
        self.p1 = {}
        self.p2 = {}
        self.p3 = {}
        self.p11 = {}
        self.p22 = {}
        self.p33 = {}
        self.make_pads()
        # margins
        self.ymin = {}
        self.xmin = {}
        self.ymax = {}
        self.xmax = {}
        self.make_margins()
        # second axis
        self.a1 = {}
        self.make_axis()
        # box
        self.b1 = self.make_box()
        # pad titles
        self.t1 = {}
        self.make_pad_title()
        # run lines
        self.run_lines = []
        self.pt = TPaveLabel(.01, .01, .1, .1, "", "NDC")
        self.pt.ResetBit(kCanDelete)
        self.pt.SetFillColor(0)
        self.pt.SetShadowColor(0)
        self.pt.SetBorderSize(0)
开发者ID:michareichmann,项目名称:ReadKeithleyCurrent,代码行数:58,代码来源:root_stuff.py

示例9: bookCanvas

    def bookCanvas(self, xSize=1600, ySize=900):
        '''
        @brief book a ROOT TCanvas
        @param xSize: size (in pixels) in the horizontal direction 
        @param ySize: size (in pixels) in the vertical direction
        '''
        self.canvas = TCanvas("TuDoUtils Canvas", "TuDoUtils Canvas", 10, 10, xSize, ySize)



        self.pad1 = TPad("pad1", "pad1", 0, 0, 1, 1, 0, 0, 0)
        self.pad2 = TPad("pad2", "pad2",  0, 0, 1, 1)


        margin = 0.08
        self.pad1.SetLeftMargin(margin)
        self.pad1.SetRightMargin(margin)
        self.pad2.SetLeftMargin(margin)
        self.pad2.SetRightMargin(margin)
开发者ID:yassya,项目名称:TuDoUtils,代码行数:19,代码来源:twoAxisPlotHolder.py

示例10: Draw

   def Draw(self,
            pad_name             = 'bottom_pad',
            pad_title            = 'Bottom Pad',
            pad_x1               = 0,
            pad_y1               = 0,
            pad_x2               = 1,
            pad_y2               = 1,
            pad_border_size      = 1,
            pad_ratio_order      = REFERENCE_IS_DENOMINATOR,
            pad_bottom_margin    = 0,
            pad_top_margin       = 0,
            pad_left_margin      = 0,
            pad_right_margin     = 0,
            yaxis_min            = 0.9,
            yaxis_max            = 1.1,
            y_ndiv               = None,
            y_title              = None,
            ratio_factor         = 2,
           ):
      # create the pad
      self.pad = TPad(pad_name,
                      pad_title,
                      pad_x1,
                      pad_y1,
                      pad_x2,
                      pad_y2,
                      pad_border_size,
                      0
                     )
      self.pad.SetMargin(pad_left_margin,pad_right_margin,pad_bottom_margin,pad_top_margin)
      self.pad.SetFillColor(0)
      self.pad.Draw()
      self.pad.cd()
      
      # create ratio plot for reference
      self.reference_plot.CreateRatio(self.reference_plot,pad_ratio_order)
      # the ratio plot will be plotted first so it determines the axes
      self.reference_plot.ratio.SetMaximum(yaxis_max)
      self.reference_plot.ratio.SetMinimum(yaxis_min)
      # here I setup the ratio to show up 
      self.reference_plot.ratio.GetXaxis().SetLabelSize(self.reference_plot.ratio.GetXaxis().GetLabelSize()*ratio_factor)
      self.reference_plot.ratio.GetYaxis().SetLabelSize(self.reference_plot.ratio.GetYaxis().GetLabelSize()*ratio_factor)
      self.reference_plot.ratio.GetXaxis().SetTitleSize(self.reference_plot.ratio.GetXaxis().GetTitleSize()*ratio_factor)
      self.reference_plot.ratio.GetYaxis().SetTitleSize(self.reference_plot.ratio.GetYaxis().GetTitleSize()*ratio_factor)

      if y_ndiv is not None:
         self.reference_plot.ratio.GetYaxis().SetNdivisions(y_ndiv)
      if y_title is not None:
         self.reference_plot.ratio.GetYaxis().SetTitle(y_title)

      self.reference_plot.DrawRatio()

      for plot in self.plots:
         plot.CreateRatio(self.reference_plot,pad_ratio_order)
         plot.DrawRatio(same=True)
开发者ID:jtchilders,项目名称:python_tools,代码行数:55,代码来源:RatioCanvas.py

示例11: overlayAndRatio

def overlayAndRatio(canvas, min_ratio, max_ratio, h1, h2):
  canvas.ResetAttPad()
  canvas.Clear()
  pad = TPad("main","main", 0, 0.3, 1, 1)
  pad.SetBottomMargin(0.05);
  pad.Draw()
  pad.cd()
  h1.Draw()
  h2.SetLineColor(kOrange+10)
  h2.Draw('SAME')
  canvas.cd()
  ratio = TPad("ratio","ratio", 0, 0.05, 1, 0.3);
  ratio.SetTopMargin(0.05);
  ratio.Draw()
  ratio.cd()
  if isinstance(h1, TProfile) and isinstance(h2, TProfile):
    h1_p = h1.ProjectionX()
    h2_p = h2.ProjectionX()
    h1_p.Divide(h2_p)
    h1_p.SetMaximum(max_ratio)
    h1_p.SetMinimum(min_ratio)
    h1_p.SetMarkerStyle(kFullCircle)
    h1_p.SetMarkerSize(0.6)
    h1_p.SetTitle('')
    h1_p.GetXaxis().SetLabelFont(42)
    h1_p.GetXaxis().SetLabelSize(0.1)
    h1_p.GetYaxis().SetLabelFont(42)
    h1_p.GetYaxis().SetLabelSize(0.1)
    h1_p.GetYaxis().SetNdivisions(505)
    equality = TLine()
    h1_p.Draw("SAME HIST P")
    equality.SetLineColor(kOrange+10)
    equality.DrawLine(h1_p.GetXaxis().GetXmin(), 1, h1_p.GetXaxis().GetXmax(), 1)
开发者ID:AdrianoDee,项目名称:CmsswMy,代码行数:33,代码来源:materialEffect.py

示例12: makeTwoScalesGraph

def makeTwoScalesGraph(file):
    print(file)
    ch1 = OPData.fromPath('../data/part3/%s' % file, 1)
    ch2 = OPData.fromPath('../data/part3/%s' % file, 2)

    print('make canvas + pad')
    c = TCanvas('c-%s' % file, '', 1280, 720)
    pad = TPad('pad-%s' % file, '', 0, 0, 1, 1)
    pad.Draw()
    pad.cd()

    print('frame')
    frame = pad.DrawFrame(0, min(ch1.getY()) * 1.1, 0.051, max(ch1.getY()) * 1.1)
    frame.SetXTitle('Zeit t / s')
    frame.GetXaxis().CenterTitle()
    frame.SetYTitle('Spannung Spule 2: U_{2} / V')
    frame.GetYaxis().CenterTitle()
    frame.GetYaxis().SetLabelColor(4)
    frame.GetYaxis().SetTitleColor(4)

    print('g1')
    g1 = ch1.makeGraph('g1-%s' % file)
    prepareGraph(g1)
    g1.Draw('PX')

    print('overlay')
    c.cd()
    overlay = TPad('overlay-%s' % file, '', 0, 0, 1, 1)
    overlay.SetFillStyle(4000)  # transparent
    overlay.SetFillColor(0)  # white
    overlay.SetFrameFillStyle(4000)  # transparent
    overlay.Draw()
    overlay.cd()

    print('g2')
    g2 = ch2.makeGraph('g2-%s' % file)
    prepareGraph(g2, 2)
    g2ymin = min(ch2.getY())
    xmin = pad.GetUxmin()
    xmax = pad.GetUxmax()
    ymin = 1.1 * g2ymin
    ymax = abs(ymin)
    if file == '07.tab':  # same scale like 06.tab
        ymin, ymax = -0.07128, 0.07128
    oframe = overlay.DrawFrame(xmin, ymin, xmax, ymax)
    oframe.GetXaxis().SetLabelOffset(99)
    oframe.GetYaxis().SetLabelOffset(99)
    oframe.GetYaxis().SetTickLength(0)
    g2.Draw('PX')

    print('axis')
    axis = TGaxis(xmax, ymin, xmax, ymax, ymin, ymax, 510, "+L")
    axis.SetTitle('Spannung Photodiode: U_{ph} / V')
    axis.CenterTitle()
    axis.SetTitleOffset(1.2)
    axis.Draw()

    print('print')
    c.Update()
    c.Print('../img/part3/%s.pdf' % file[:-4], 'pdf')
开发者ID:Bigben37,项目名称:FP2,代码行数:60,代码来源:part3.py

示例13: setupCanvas

    def setupCanvas(self):
        
        # setup ATLAS plotting style
        self.logger.info("Load ATLAS plotting style")
        
        atlas_style()
        
        # create canvas
        self.logger.info("Begin to define canvas")

        # If want ratio plot to be shown at the bottom, define its fraction first
        if self.ratio<=0: canvas_w,canvas_h=800,600
        elif self.ratio>0: canvas_w,canvas_h=800,int(600*(1+self.ratio))
        else:
            self.logger.error("The scale of RATIO plot is wrongly defined: %.4f".format(self.ratio))
            sys.exit(-1)
            
        # Define canvas and create sub pad if needed
        gStyle.SetPadLeftMargin(0.15)
        gStyle.SetPadRightMargin(0.10)
        gStyle.SetPadTopMargin(0.06)
        gStyle.SetPadBottomMargin(0.15)
        self.MyC=TCanvas('MyC','MyC',canvas_w,canvas_h)
        self.MyC.SetTicks(1,1)
        if self.ratio>0:
            fraction=self.ratio+0.2
            self.Pad1 = TPad("p1","p1",0,fraction*1.0/(fraction+1),1,1,0,0) # x1,y1,x2,y2
            self.Pad1.SetMargin(0.15,0.10,0.03,0.05) # left, right, bottom, top
            self.Pad2 = TPad("p2","p2",0,0,1,fraction*1.0/(fraction+1),0,0)
            self.Pad2.SetMargin(0.15,0.10,0.15/fraction,0)
            self.Pad1.Draw()
            self.Pad2.Draw()
            self.Pad2.SetGrid()
            self.logger.info("Canvas is defined as (width={0},height={1}): Ratio Plot Pad / Main Pad = {2:0.3f}".format(canvas_w,canvas_h,self.ratio))
        else:
            self.logger.info("Canvas is defined as (width={0},height={1})".format(canvas_w,canvas_h))        
        
        # put a end mark
        return
开发者ID:WestDan,项目名称:VBS-ZZ,代码行数:39,代码来源:oneplot.py

示例14: draw

	def draw(self, title):
		'''
		draws regression and residuals in one canvas
		'''
		self.residuals()
		from ROOT import TCanvas, TPad, TLine
		from random import randint
		from sys import maxint

		random_name = randint(0,maxint)
		self.canvas = TCanvas("canvas{}".format( random_name), "Linear Regression", 1300, 800)
		self.canvas.SetBatch()
		hPad = TPad("fitPad{}".format( random_name ), "Fit", 0, 0.3, 1, 1)
		hPad.SetFillStyle(4000)
		hPad.SetBorderSize(0)
		hPad.SetBottomMargin(0)
		hPad.Draw()
		hPad.cd()
		self.graph.SetTitle( title )
		self.resgraph.GetXaxis().SetTitle("")
		self.graph.Draw("ap")

		self.canvas.cd()
		residualPad = TPad("resPad{}".format( random_name ), "Residuals", 0, 0, 1, 0.3)
		residualPad.SetFillStyle(4000)
		residualPad.SetFrameFillStyle(4000)
		residualPad.SetBorderSize(0)
		residualPad.Draw()
		residualPad.cd()
		# get y-label for residuals
		from re import match
		try:
			splittitle = title.split(';')
			val, unit = match( '(.*)\[(.*)\]', splittitle[2] ).groups()
			restitle = splittitle[0] + ';' + splittitle[1] + ';' + val + '- fit [' + unit + ']'
			self.resgraph.SetTitle( restitle )
		except:
			self.resgraph.SetTitle( title + ' - fit' )
		xaxis = self.resgraph.GetXaxis()
		xaxis.SetTitleSize(.15)
		xaxis.SetTitleOffset(.3)
		xaxis.SetLabelSize(.1)
		self.resgraph.GetYaxis().SetNdivisions( 8,0 ,0 )
		self.resgraph.GetYaxis().SetTitleSize(.18)
		self.resgraph.GetYaxis().SetTitleOffset(.23)
		self.resgraph.GetYaxis().SetLabelSize(.2)
		self.resgraph.Draw("ap")
		self.line = TLine( xaxis.GetXmin(), 0, xaxis.GetXmax(), 0 )
		self.line.Draw()
开发者ID:Varrog-gosh,项目名称:laborpraktikum_teilchenphysik_rwth,代码行数:49,代码来源:tools.py

示例15: drawCanvas2

def drawCanvas2():
    c1 = TCanvas("c1", "c1", 700, 700)
    pad1 = TPad("pad1", "top pad"   , 0.0, 0.3, 1.0, 1.0)
    pad1.SetBottomMargin(0.0)
    pad1.SetNumber(1)
    pad1.Draw()
    pad1.cd()
    c1.cd()
    pad2 = TPad("pad2", "bottom pad", 0.0, 0.0, 1.0, 0.3)
    pad2.SetTopMargin(0.0)
    pad2.SetBottomMargin(0.35)
    pad2.SetNumber(2)
    pad2.Draw()
    pad2.cd()
    c1.cd()
    return c1
开发者ID:degrutto,项目名称:VHbbUF,代码行数:16,代码来源:ngZbbHinv.py


注:本文中的ROOT.TPad类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。