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


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

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


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

示例1: MovePaletteHorizontally

 TPaletteAxis* MovePaletteHorizontally(TH1 *histo, Double_t step) {
   TPaletteAxis *palette = (TPaletteAxis*)histo->GetListOfFunctions()->FindObject("palette");
   if (palette) {
     palette->SetX1NDC(palette->GetX1NDC()-step);
     palette->SetX2NDC(palette->GetX2NDC()-step);
     palette->GetAxis()->SetLabelOffset(0.01);
   } else {
     std::cout << "Palette not found!"  << std::endl;
   }
   return palette;
 }
开发者ID:FCALSW,项目名称:FCalClusterer,代码行数:11,代码来源:RootUtils.cpp

示例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");
    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

示例3: 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

示例4: PlotRakeBunch


//.........这里部分代码省略.........
  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,代码行数:66,代码来源:PlotRakeBunch.130712.C

示例5: PlotChargeFieldFocus2D


//.........这里部分代码省略.........
  
  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); 
      
      if(content<denmin) 
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotChargeFieldFocus2D.130705.C

示例6: PlotRakeInjection


//.........这里部分代码省略.........
  
    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);
    palette->SetLineColor(1);
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotRakeInjection.C

示例7: macro_2Dhisto

void macro_2Dhisto(TString channel, TString njmt, TString syst, TString region, TString BDT1_name, TString BDT2_name, TString lep){
  if((lep=="electron"||lep=="electronantiiso")&& channel=="QCDMuPt20toInf") return;
  if((lep=="muonantiiso"||lep=="electronantiiso") && channel=="TT_sd") return;
  if((channel.Contains("hdamp")||channel.Contains("psq2"))&&((lep=="muonantiiso"||lep=="electronantiiso")||(syst!=""))) return;
  TFile * f=TFile::Open("trees_lumi/"+lep+"/trees_"+channel+"_"+lep+".root");
  TString treename, histoname;
  TH2F * h2 = new TH2F("h2", "h2",10,-1,1,10,-1,1);
  //  Float_t BDT1, BDT2, etajprime, mtw, w, w_nominal, var_syst; 
  gStyle->SetOptStat(0);
  TString outfilename, taglio, selection;
  selection = "BDT_"+BDT1_name+":BDT_"+BDT2_name;
  if(syst.EqualTo("jesUp")||syst.EqualTo("jesDown")||syst.EqualTo("jerUp")||syst.EqualTo("jerDown")) treename = "events_"+njmt+"_"+syst;
  else treename = "events_"+njmt;
  TTree * t =(TTree*)f->Get(treename);
  if(region=="cr") taglio = "(mtw>50 && etajprime<2.4";
  else taglio = "(mtw>50 && etajprime>2.4";
  if(lep=="electronantiiso") taglio += " &&mlb>30";
  if(syst.EqualTo("")){
    histoname = "h2D_"+njmt+"_"+channel+"_"+region;
    t->Project("h2",selection,taglio+")*w*w_nominal");
  }
  else{
    if(syst.EqualTo("jesUp")||syst.EqualTo("jesDown")||syst.EqualTo("jerUp")||syst.EqualTo("jerDown")){
      histoname = "h2D_"+njmt+"_"+channel+"_"+region+"_"+syst;
      t->Project("h2",selection,taglio+")*w*w_nominal");
    }
    else{
      histoname = "h2D_"+njmt+"_"+channel+"_"+region+"_"+syst;
      t->Project("h2",selection,taglio+")*w*"+syst);
    }
  }
  h2->SetName(histoname);
  TCanvas * c = new TCanvas( "c1"," ");
  Float_t newMargin1 = 0.13;
  Float_t newMargin2 = 0.15;
  c->SetGrid();
  c->SetTicks();
  c->SetLeftMargin  ( newMargin2 );
  c->SetBottomMargin( newMargin2 );
  c->SetRightMargin ( newMargin1 );
  c->SetTopMargin   ( newMargin1 );
  gStyle->SetPalette( 1, 0 );
  gStyle->SetPaintTextFormat( "3g" );

  h2->SetMarkerSize( 1.5 );
  h2->SetMarkerColor( 0 );
  Float_t labelSize = 0.040;
  h2->GetXaxis()->SetLabelSize( labelSize );
  h2->GetYaxis()->SetLabelSize( labelSize );
  h2->GetXaxis()->SetTitle( "BDT_"+BDT1_name );
  h2->GetYaxis()->SetTitle( "BDT_"+BDT2_name );
  //  h2->LabelsOption( "d" );
  h2->SetLabelOffset( 0.011 );// label offset on x axis    
  h2->Draw("colz"); // color pads   
  c->Update();
  // modify properties of paletteAxis
  TPaletteAxis * paletteAxis = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject( "palette" );
  paletteAxis->SetLabelSize( 0.03 );
  paletteAxis->SetX1NDC( paletteAxis->GetX1NDC() + 0.02 );

  h2->Draw("textsame");  // add text
  // TMVAGlob::plot_logo( );
  c->Update();
  outfilename = "Plot/histo2D_"+lep+".root";
  TFile * fout = TFile::Open(outfilename, "UPDATE");
  h2->Write();
  c->SaveAs("Plot2D/"+histoname+"_"+lep+".pdf");
}
开发者ID:oiorio,项目名称:NAAnaFW,代码行数:68,代码来源:macro_2Dhisto.C

示例8: correlations

// input: - Input file (result from TMVA),
//        - use of colors or grey scale
//        - use of TMVA plotting TStyle
void correlations( TString fin = "TMVA.root",TString outputdir="plots", Bool_t isRegression = kFALSE, 
                   Bool_t greyScale = kFALSE, Bool_t useTMVAStyle = kTRUE )
{
   // set style and remove existing canvas'
   TMVAGlob::Initialize( useTMVAStyle );

   // checks if file with name "fin" is already open, and if not opens one
   TFile* file = TMVAGlob::OpenFile( fin );  

   // signal and background or regression problem
   Int_t ncls = (isRegression ? 1 : 2 );
   TString hName[2] = { "CorrelationMatrixS", "CorrelationMatrixB" };
   if (isRegression) hName[0]= "CorrelationMatrix";
   const Int_t width = 600;
   for (Int_t ic=0; ic<ncls; ic++) {

      TH2* h2 = file->Get( hName[ic] );
      if(!h2) {
         cout << "Did not find histogram " << hName[ic] << " in " << fin << endl;
         continue;
      }

      TCanvas* c = new TCanvas( hName[ic], 
                                Form("Correlations between MVA input variables (%s)", 
                                     (isRegression ? "" : (ic==0 ? "signal" : "background"))), 
                                ic*(width+5)+200, 0, width, width ); 
      Float_t newMargin1 = 0.13;
      Float_t newMargin2 = 0.15;
      if (TMVAGlob::UsePaperStyle) newMargin2 = 0.13;

      c->SetGrid();
      c->SetTicks();
      c->SetLeftMargin  ( newMargin2 );
      c->SetBottomMargin( newMargin2 );
      c->SetRightMargin ( newMargin1 );
      c->SetTopMargin   ( newMargin1 );
      gStyle->SetPalette( 1, 0 );


      gStyle->SetPaintTextFormat( "3g" );

      h2->SetMarkerSize( 1.5 );
      h2->SetMarkerColor( 0 );
      Float_t labelSize = 0.040;
      h2->GetXaxis()->SetLabelSize( labelSize );
      h2->GetYaxis()->SetLabelSize( labelSize );
      h2->LabelsOption( "d" );
      h2->SetLabelOffset( 0.011 );// label offset on x axis    

      h2->Draw("colz"); // color pads   
      c->Update();

      // modify properties of paletteAxis
      TPaletteAxis* paletteAxis = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject( "palette" );
      paletteAxis->SetLabelSize( 0.03 );
      paletteAxis->SetX1NDC( paletteAxis->GetX1NDC() + 0.02 );

      h2->Draw("textsame");  // add text

      // add comment    
      TText* t = new TText( 0.53, 0.88, "Linear correlation coefficients in %" );
      t->SetNDC();
      t->SetTextSize( 0.026 );
      t->AppendPad();    

      // TMVAGlob::plot_logo( );
      c->Update();

      TString fname = outputdir +  TString("/");
      fname += hName[ic];
      TMVAGlob::imgconv( c, fname );
   }
}
开发者ID:igormarfin,项目名称:TMA-Optimization,代码行数:76,代码来源:correlations.C

示例9: PlotEvolutionsWIII


//.........这里部分代码省略.........

  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);
    Float_t xFactor = pad[0]->GetAbsWNDC()/pad[ip]->GetAbsWNDC();
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotEvolutionsWIII.C

示例10: PlotPotential2D


//.........这里部分代码省略.........
        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);
        palette->SetY1NDC(y1 + 0.00);
开发者ID:delaossa,项目名称:ptools,代码行数:67,代码来源:PlotPotential2D.C

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