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


C++ TPaletteAxis::SetY1NDC方法代码示例

本文整理汇总了C++中TPaletteAxis::SetY1NDC方法的典型用法代码示例。如果您正苦于以下问题:C++ TPaletteAxis::SetY1NDC方法的具体用法?C++ TPaletteAxis::SetY1NDC怎么用?C++ TPaletteAxis::SetY1NDC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TPaletteAxis的用法示例。


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

示例1: repositionPalette

void repositionPalette(std::string name)
{
    // Reposition and resize palette
    TH2F *h = (TH2F*)gDirectory->GetList()->FindObject(name.c_str());
    TPaletteAxis *pal;
    pal = (TPaletteAxis*)h->FindObject("palette");
    pal->SetX1NDC(0.83);
    pal->SetY1NDC(0.14);
    pal->SetX2NDC(0.88);
    pal->SetY2NDC(0.60);
    pal->SetLabelSize(.04);
}
开发者ID:frmeier,项目名称:usercode,代码行数:12,代码来源:dataPlots01.C

示例2: repositionPalette

void repositionPalette(std::string name)
{
    // Reposition and resize palette
    TH2F *h = (TH2F*)gDirectory->GetList()->FindObject(name.c_str());
    TPaletteAxis *pal;
    pal = (TPaletteAxis*)h->FindObject("palette");
    if (0==pal)
    {
	cout << "Palette not found - cannot reposition it" << endl;
	return;
    }
    pal->SetX1NDC(0.83);
    pal->SetY1NDC(0.14);
    pal->SetX2NDC(0.88);
    pal->SetY2NDC(0.60);
    pal->SetLabelSize(.04);
    cout << "Repo" << endl;
}
开发者ID:frmeier,项目名称:usercode,代码行数:18,代码来源:genPlots02.C

示例3: PlotRakeBunch


//.........这里部分代码省略.........
  lZmean.SetLineStyle(2);
  lZmean.Draw();

  TLine lPmean(hP1X1->GetXaxis()->GetXmin(),ymean,hP1X1->GetXaxis()->GetXmax(),ymean);
  lPmean.SetLineColor(kGray+2);
  lPmean.SetLineStyle(2);
  lPmean.Draw();


  hP1X1->GetYaxis()->SetNdivisions(503);
  hP1X1->GetZaxis()->SetNdivisions(503);
  hP1X1->GetZaxis()->SetRangeUser(0.001*hP1X1->GetMaximum(),hP1X1->GetMaximum());
  hP1X1->GetZaxis()->SetLabelSize(0.05);
  hP1X1->GetZaxis()->SetTitleSize(0.04);
  hP1X1->GetZaxis()->SetTitleFont(42);

  hP1X1->Draw("colzsame");
  // hP1X1->SetContour(20);
  // hP1X1->Draw("contzsame");
  // hP1X1prof->SetMarkerStyle(1);
  // hP1X1prof->SetLineWidth(2);
  // hP1X1prof->Draw("zsame");

  //hP1->Draw("C");
  
  gPad->Update();

  TPaletteAxis *palette = (TPaletteAxis*)hP1X1->GetListOfFunctions()->FindObject("palette");
  if(palette) {
    Float_t y1 = gPad->GetBottomMargin();
    Float_t y2 = 1 - gPad->GetTopMargin();
    Float_t x1 = 1 - gPad->GetRightMargin();
    palette->SetY2NDC(y2 - 0.04);
    palette->SetY1NDC(y1 + 0.04);
    palette->SetX1NDC(x1 + 0.01);
    palette->SetX2NDC(x1 + 0.04);
    
    palette->SetLabelFont(42);
    
    palette->SetLabelSize(0.08);
    //palette->SetLabelOffset(0.005/vfactor);
    palette->SetTitleSize(0.10);
    //    palette->SetTitleOffset(9999.0*vfactor);
    palette->SetTitleOffset(0.6);
    
    palette->SetBorderSize(2);
    palette->SetLineColor(1);
  }


  textTime->Draw();
  textInfo->Draw();
  // textCharge->Draw();
  textMom->Draw();
   
  gPad->RedrawAxis(); 

  // Bottom plot -----------------------------------------

  C->cd();

  pad[0]->Draw();
  pad[0]->cd();

  hFrame[0]->GetYaxis()->SetRangeUser(0.0,1.1*yMax);
  hFrame[0]->Draw();
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotRakeBunch.130712.C

示例4: PlotChargeFieldFocus2D


//.........这里部分代码省略.........
  hDen2D[0]->Draw("colz same");
  
  if(hDen2D[1]) {
    exElec->Draw();
    hDen2D[1]->Draw("colz same");
  }
  
  if(opt.Contains("1dline")) {
    lineYzero->Draw();
    lineYdown->Draw();
    lineYup->Draw();
  }

  if(zStartPlasma>xmin && zStartPlasma<xmax)
    lineStartPlasma->Draw();
  if(zStartNeutral>xmin && zStartNeutral<xmax)
    lineStartNeutral->Draw();
  if(zEndNeutral>xmin && zEndNeutral<xmax)
    lineEndNeutral->Draw();
  
  pad[0]->Update();
  TPaletteAxis *palette = NULL;
  for(Int_t i=0;i<Nspecies;i++) {
    
    if(!hDen2D[i]) continue;
    palette = (TPaletteAxis*) hDen2D[i]->GetListOfFunctions()->FindObject("palette");
    if(!palette) continue;

    Float_t y1 = gPad->GetBottomMargin();
    Float_t y2 = 1 - gPad->GetTopMargin();
    Float_t x1 = gPad->GetLeftMargin();
    Float_t x2 = 1 - gPad->GetRightMargin();
    palette->SetY2NDC( (i+1)*(y2-y1)/Nspecies + y1);
    palette->SetY1NDC( i*(y2-y1)/Nspecies + y1);
    palette->SetX1NDC(x2 + 0.005);
    palette->SetX2NDC(x2 + 0.03);
    palette->SetTitleOffset(0.65);
    palette->SetTitleSize(0.07);
    palette->SetLabelSize(0.065);
    palette->SetBorderSize(2);
    palette->SetLineColor(1);
  
  }


  // 1D charge density plots:
  Float_t yaxismin  =  pad[0]->GetUymin();
  Float_t yaxismax  =  pad[0]->GetUymin() + 0.33*(pad[0]->GetUymax() - pad[0]->GetUymin()) - 0.00;
  
  //  Float_t denmin = (0.1001) * density;
  Float_t denmin = gMin;
  Float_t denmax = gMax;
  if(opt.Contains("logz")) {
    denmin = TMath::Log10(denmin);
    denmax = TMath::Log10(denmax);
  }
  
  for(Int_t i=0;i<Nspecies;i++) {
    if(!hDen1D[i]) continue;
    
    Float_t slope = (yaxismax - yaxismin)/(denmax - denmin);
    
    for(Int_t j=0;j<hDen1D[i]->GetNbinsX();j++) {
      Float_t content = hDen1D[i]->GetBinContent(j+1);
      if(opt.Contains("logz")) content = TMath::Log10(content); 
      
开发者ID:delaossa,项目名称:ptools,代码行数:66,代码来源:PlotChargeFieldFocus2D.130705.C

示例5: PlotRakeInjection


//.........这里部分代码省略.........
    hFrame[k]->GetYaxis()->SetTitleOffset(999.0*vfactor);
  
    if(k==0) {  
      hFrame[k]->GetXaxis()->SetLabelSize(0.10);
      hFrame[k]->GetXaxis()->SetLabelOffset(0.02);
      hFrame[k]->GetXaxis()->SetTitleSize(0.14);
      hFrame[k]->GetXaxis()->SetTitleOffset(1.0);
    } else {
      hFrame[k]->GetXaxis()->SetLabelSize(0.0);
      hFrame[k]->GetXaxis()->SetTitleSize(0.0);
    }
  
    hFrame[k]->Draw("axis");    
  


    exPlasma->Draw();

    // Sum of histograms!
    hDen2D[k][0]->Add(hDen2D[k][1]);
        
    //    hDen2D[k][0]->GetZaxis()->SetRangeUser(Min[1],Max[1]);
 
    hDen2D[k][0]->Draw("colz same");
    
    pad[k]->Update();
    TPaletteAxis *palette = (TPaletteAxis*)hDen2D[k][0]->GetListOfFunctions()->FindObject("palette");
    
    Float_t y1 = pad[k]->GetBottomMargin();
    Float_t y2 = 1 - pad[k]->GetTopMargin();
    Float_t x1 = pad[k]->GetLeftMargin();
    Float_t x2 = 1 - pad[k]->GetRightMargin();
    palette->SetY2NDC(y2 - 1*(y2-y1)/2.0 - 0.00);
    palette->SetY1NDC(y1 + 0*(y2-y1)/2.0 + 0.00);
    palette->SetX1NDC(x2 + 0.005);
    palette->SetX2NDC(x2 + 0.03);

    palette->SetLabelFont(42);

    palette->SetLabelSize(0.03/vfactor);
    palette->SetLabelOffset(-0.004);
    palette->SetTitleSize(0.03/vfactor);
    palette->SetTitleOffset(9999.0*vfactor);
  
    palette->SetBorderSize(2);
    palette->SetLineColor(1);
  
    exHot->Draw();
    hDen2D[k][2]->Draw("colz same");

    pad[k]->Update();
    palette = (TPaletteAxis*)hDen2D[k][2]->GetListOfFunctions()->FindObject("palette");
    
    palette->SetY2NDC(y2 - 0*(y2-y1)/2.0 - 0.00);
    palette->SetY1NDC(y1 + 1*(y2-y1)/2.0 + 0.00);
    palette->SetX1NDC(x2 + 0.005);
    palette->SetX2NDC(x2 + 0.03);

    palette->SetLabelFont(42);

    palette->SetLabelSize(0.03/vfactor);
    palette->SetLabelOffset(-0.004);
    palette->SetTitleSize(0.03/vfactor);
    palette->SetTitleOffset(9999.0*vfactor);

    palette->SetBorderSize(2);
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotRakeInjection.C

示例6: PlotEvolutionsWIII


//.........这里部分代码省略.........
  UInt_t ip = NPad-1;

  if(mask & 0x1) {

    pad[ip]->Draw();
    pad[ip]->cd(); 
    if(opt.Contains("logz")) {
      pad[ip]->SetLogz(1);
    } else {
      pad[ip]->SetLogz(0);
    }

    hFrame[ip]->Draw("col");

    //  hDen1DvsTime->GetZaxis()->SetNdivisions(503);
    hDen1DvsTime->GetZaxis()->SetTitleFont(fonttype);
    Float_t xFactor = pad[0]->GetAbsWNDC()/pad[ip]->GetAbsWNDC();
    Float_t yFactor = pad[0]->GetAbsHNDC()/pad[ip]->GetAbsHNDC();
    hDen1DvsTime->GetZaxis()->SetTickLength(xFactor*tylength/yFactor);
    
    exElec->Draw();
    hDen1DvsTime->Draw("colz same");

    pad[ip]->Update();
  
    y1 = pad[ip]->GetBottomMargin();
    y2 = 1 - pad[ip]->GetTopMargin();
    x1 = pad[ip]->GetLeftMargin();
    x2 = 1 - pad[ip]->GetRightMargin();
  
    palette = (TPaletteAxis*) hDen1DvsTime->GetListOfFunctions()->FindObject("palette");  
    if(palette) {
      palette->SetY2NDC(y2 - gap);
      palette->SetY1NDC(y1 + gap);
      palette->SetX1NDC(x2 + 0.005);
      palette->SetX2NDC(x2 + 0.03);
      palette->SetTitleOffset(tzoffset);
      palette->SetTitleSize(tzsize);
      palette->SetLabelFont(fonttype);
      palette->SetLabelSize(lzsize);
      palette->SetLabelOffset(lyoffset);
      palette->SetBorderSize(2);
      palette->SetLineColor(1);
    }
   
    pad[ip]->RedrawAxis(); 

    ip--;
    C->cd(0);
    
  }

  if(mask & 0x2) {

    pad[ip]->Draw();
    pad[ip]->cd(); 
    if(opt.Contains("logz")) {
      pad[ip]->SetLogz(1);
    } else {
      pad[ip]->SetLogz(0);
    }

    hFrame[ip]->Draw("col");

    //  hRmsvsTime->GetZaxis()->SetNdivisions(503);
    hRmsvsTime->GetZaxis()->SetTitleFont(fonttype);
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotEvolutionsWIII.C

示例7: PlotPotential2D


//.........这里部分代码省略.........
    if(opt.Contains("1dline")) {
        lineYzero->Draw();
        lineYdown->Draw();
        lineYup->Draw();
    }

    if(opt.Contains("sline")) {
        if(zStartPlasma>xmin && zStartPlasma<xmax)
            lineStartPlasma->Draw();
        if(zStartNeutral>xmin && zStartNeutral<xmax)
            lineStartNeutral->Draw();
        if(zEndNeutral>xmin && zEndNeutral<xmax)
            lineEndNeutral->Draw();
    }

    // lineYdown->Draw();
    // lineYup->Draw();

    // Palettes re-arrangement
    pad[0]->Update();
    Float_t y1 = pad[0]->GetBottomMargin();
    Float_t y2 = 1 - pad[0]->GetTopMargin();
    Float_t x1 = pad[0]->GetLeftMargin();
    Float_t x2 = 1 - pad[0]->GetRightMargin();

    TPaletteAxis *palette = NULL;
    if(Nspecies>=3) {
        if(hDen2D[2]) {
            palette = (TPaletteAxis*)hDen2D[2]->GetListOfFunctions()->FindObject("palette");
        }
    }
    if(palette) {
        palette->SetY2NDC(y2 - 0.00);
        palette->SetY1NDC(0.66*(y1+y2) + 0.00);
        palette->SetX1NDC(x2 + 0.005);
        palette->SetX2NDC(x2 + 0.03);
        //  palette->SetTitleFont(42);
        //  palette->SetTitleOffset(0.85);
        palette->SetTitleOffset(999.9);
        palette->SetTitleSize(0.075);
        palette->SetLabelFont(42);
        palette->SetLabelSize(0.075);
        palette->SetLabelOffset(0.001);
        palette->SetBorderSize(2);
        palette->SetLineColor(1);
    }

    palette = (TPaletteAxis*)hDen2D[0]->GetListOfFunctions()->FindObject("palette");
    if(palette) {
        palette->SetY2NDC(0.66*(y1+y2) - 0.00);
        palette->SetY1NDC(0.33*(y1+y2) + 0.00);
        palette->SetX1NDC(x2 + 0.005);
        palette->SetX2NDC(x2 + 0.03);
        // palette->SetTitleFont(42);
        palette->SetTitleOffset(0.80);
        palette->SetTitleSize(0.075);
        palette->SetLabelFont(42);
        palette->SetLabelSize(0.075);
        palette->SetLabelOffset(0.001);
        palette->SetBorderSize(2);
        palette->SetLineColor(1);
    }

    palette = (TPaletteAxis*)hDen2D[1]->GetListOfFunctions()->FindObject("palette");
    if(palette) {
        palette->SetY2NDC(0.33*(y1+y2) - 0.00);
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotPotential2D.C

示例8: plot


//.........这里部分代码省略.........
  TFile* f =  new TFile(file_name.c_str(),"READ");
  TDirectory* d = (TDirectory*)f->Get(dir.c_str());
  TH2D* his = (TH1*)d->Get(histo.c_str());
  if ( !his ) return;

  //his->Rebin2D(2,2);

  if ( true ) { gPad->SetLogz(); }
  if ( scale ) his->Scale( lumi / 100. );
  his->SetMaximum(1.e4);
  his->SetMinimum(1.e-5);
  //his->SetMinimum( his->GetMinimum(1.e-12) );

//   his->SetMaximum( 20000. );
//   his->SetMinimum( 2.e-4 );

//   his->SetMaximum( 20000. );
//   his->SetMinimum( 20. );

  double xmin = his->GetXaxis()->GetXmin();
  double xmax = his->GetXaxis()->GetXmax();
  double ymin = his->GetYaxis()->GetXmin();
  double ymax = his->GetYaxis()->GetXmax();
  
  // Reset title
  std::string title = ";" + std::string(his->GetXaxis()->GetTitle()) + ";" + std::string(his->GetYaxis()->GetTitle());
  his->SetTitle(title.c_str());
  his->GetXaxis()->SetTitle("x_{2}");
  his->GetXaxis()->SetTitleOffset(1.2);
  his->GetYaxis()->SetTitle("x_{1}");
  his->GetYaxis()->SetTitleOffset(1.4);
  his->Draw("COLZ");
  gPad->Update();

  // Lumi
  if (1) { 
    std::stringstream ss;

    ss << "#int L dt = " << lumi << " pb^{-1}";
    double xpos = 0.05 * (xmax-xmin)+xmin;
    double ypos = 0.25 * (ymax-ymin)+ymin;
    TLatex* text1 = new TLatex(xpos,ypos,ss.str().c_str());
    text1->SetTextAlign(12); 
    text1->SetTextSize(0.035);
    text1->Draw();
  }

  // Jet type
  if (1) { 
    double xpos = 0.05 * (xmax-xmin)+xmin;
    double ypos = 0.15 * (ymax-ymin)+ymin;
    TText* text2 = new TText(xpos,ypos,type.c_str());
    text2->SetTextAlign(12); 
    text2->SetTextSize(0.035);
    text2->Draw();
  }

  // Sample
  if (1) {
    double xpos = 0.05 * (xmax-xmin)+xmin;
    double ypos = 0.10 * (ymax-ymin)+ymin;
    TText* text3 = new TText(xpos,ypos,sample.c_str());
    text3->SetTextAlign(12); 
    text3->SetTextSize(0.035);
    text3->Draw();
  }

  // Stats
  gStyle->SetOptStat("i");
  his->SetStats(1);
  TPaveStats* stats = (TPaveStats*)his->GetListOfFunctions()->FindObject("stats"); 
  std::string stats_pos = "br";
  if ( stats ) { 
    stats->SetFillColor(0);
    stats->SetLineColor(0); 
    stats->SetShadowColor(0); 
    if ( stats_pos == "tr" ) {
      stats->SetX1NDC(0.60); stats->SetY1NDC(0.68); stats->SetX2NDC(0.83); stats->SetY2NDC(0.88); 
    } else if ( stats_pos == "br" ) {
      stats->SetX1NDC(0.60); stats->SetY1NDC(0.18); stats->SetX2NDC(0.83); stats->SetY2NDC(0.28); 
    } else {
      stats->SetX1NDC(0.60); stats->SetY1NDC(0.68); stats->SetX2NDC(0.83); stats->SetY2NDC(0.88); 
    }
  }

   // Scale
  gStyle->SetPalette(1);
  TPaletteAxis* palette = (TPaletteAxis*)his->GetListOfFunctions()->FindObject("palette");
  if ( palette ) {
    palette->SetY1NDC(0.2);
    palette->SetY2NDC(0.8);
  }

  canvas->Modified();
  canvas->cd();
  canvas->SetSelected(canvas);
  canvas->SaveAs(std::string(canvas_name+".png").c_str());
  //canvas->Write();

}
开发者ID:bainbrid,项目名称:usercode,代码行数:101,代码来源:plot_2d.C

示例9: PlotField2D


//.........这里部分代码省略.........
  // Define the frames for plotting
  Int_t fonttype = 43;
  Int_t fontsize = 28;
  Int_t tfontsize = 30;
  Float_t txoffset = 1.3;
  Float_t lxoffset = 0.02;
  Float_t tyoffset = 1.0;
  Float_t lyoffset = 0.01;
  Float_t tylength = 0.02;
  Float_t txlength = 0.04;

  TH2F *hFrame = (TH2F*) gROOT->FindObject("hFrame");
  if(hFrame) delete hFrame;
  hFrame = (TH2F*) hE2D[index]->Clone("hFrame");
  hFrame->Reset();

  // Format for y axis
  hFrame->GetYaxis()->SetTitleFont(fonttype);
  hFrame->GetYaxis()->SetTitleSize(tfontsize);
  hFrame->GetYaxis()->SetTitleOffset(tyoffset);
  hFrame->GetYaxis()->SetLabelFont(fonttype);
  hFrame->GetYaxis()->SetLabelSize(fontsize);
  hFrame->GetYaxis()->SetLabelOffset(lyoffset);

  hFrame->GetYaxis()->SetTickLength(tylength);

  // Format for x axis
  hFrame->GetXaxis()->SetTitleFont(fonttype);
  hFrame->GetXaxis()->SetTitleSize(tfontsize+2);
  hFrame->GetXaxis()->SetTitleOffset(txoffset);
  hFrame->GetXaxis()->SetLabelFont(fonttype);
  hFrame->GetXaxis()->SetLabelSize(fontsize+2);
  hFrame->GetXaxis()->SetLabelOffset(lxoffset);
    
  hFrame->GetXaxis()->SetTickLength(txlength);      

  hFrame->Draw("col");            
 
  //  hE2D[index]->GetZaxis()->SetNdivisions(505);  
  hE2D[index]->GetZaxis()->SetTitleFont(fonttype);
  hE2D[index]->Draw("colz same");
    
  // Re-touchs
  gPad->Update();

  Float_t y1 = gPad->GetBottomMargin();
  Float_t y2 = 1 - gPad->GetTopMargin();
  Float_t x1 = gPad->GetLeftMargin();
  Float_t x2 = 1 - gPad->GetRightMargin();
  Float_t gap = 0.005;  

  TPaletteAxis *palette = (TPaletteAxis*)hE2D[index]->GetListOfFunctions()->FindObject("palette");
  if(palette) {
    palette->SetY2NDC(y2 - gap);
    palette->SetY1NDC(y1 + gap);
    palette->SetX1NDC(x2 + 0.005);
    palette->SetX2NDC(x2 + 0.03);
    palette->SetTitleOffset(tyoffset);
    palette->SetTitleSize(tfontsize);
    palette->SetLabelFont(fonttype);
    palette->SetLabelSize(fontsize);
    if(opt.Contains("logz")) 
      palette->SetLabelOffset(0);
    else
      palette->SetLabelOffset(lyoffset);
    palette->SetBorderSize(2);
    palette->SetLineColor(1);
  }
 
  
  // Text objects
  TPaveText *textTime = new TPaveText(xMax - 0.30*xRange, yMax-0.10*yRange, xMax-0.02*xRange, yMax-0.02*yRange);
  PGlobals::SetPaveTextStyle(textTime,32); 
  char ctext[128];
  if(opt.Contains("units") && n0) 
    sprintf(ctext,"z = %5.1f #mum", Time * skindepth / PUnits::um);
  else
    sprintf(ctext,"#omega_{p} t = %5.1f",Time);
  textTime->AddText(ctext);
  
  TPaveText *textDen = new TPaveText(xMin + 0.02*xRange, yMax-0.10*yRange, xMin + 0.40*xRange, yMax-0.02*yRange);
  PGlobals::SetPaveTextStyle(textDen,12); 
  textDen->SetTextColor(kOrange+10);
  if(opt.Contains("units") && n0) {
    sprintf(ctext,"n_{0} = %5.2f x 10^{17} / cm^{3}", 1e-17 * n0 * PUnits::cm3);
    textDen->AddText(ctext);
    textDen->Draw();
  }
  
  textTime->Draw();
  
  gPad->RedrawAxis(); 

  C->cd();

  // Print to a file
  PGlobals::imgconv(C,fOutName,opt);
  // ---------------------------------------------------------

}
开发者ID:delaossa,项目名称:ptools,代码行数:101,代码来源:PlotField2D.C


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