本文整理汇总了C++中TGaxis::SetLabelFont方法的典型用法代码示例。如果您正苦于以下问题:C++ TGaxis::SetLabelFont方法的具体用法?C++ TGaxis::SetLabelFont怎么用?C++ TGaxis::SetLabelFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGaxis
的用法示例。
在下文中一共展示了TGaxis::SetLabelFont方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TGaxis
ReverseXAxis (TGraphAsymmErrors *g, double size)
{
// Remove the current axis
g->GetXaxis()->SetLabelOffset(999);
g->GetXaxis()->SetTickLength(0);
// Redraw the new axis
gPad->Update();
g->GetYaxis()->SetTitle("Event Selection Efficiency");
TGaxis *newaxis = new TGaxis(gPad->GetUxmax(),
gPad->GetUymin(),
gPad->GetUxmin(),
gPad->GetUymin(),
g->GetXaxis()->GetXmin(),
g->GetXaxis()->GetXmax(),
510,"-");
newaxis->SetLabelOffset(-0.04);
newaxis->SetTitle("Centrality");
newaxis->SetTitleFont(42);
newaxis->SetTitleSize(size);
newaxis->SetLabelSize(size);
newaxis->CenterTitle();
newaxis->SetLabelFont(42);
newaxis->Draw();
}
示例2: arrangeCanvas
//.........这里部分代码省略.........
axmax = 2.5;
ndiv = 505;
} else if (myTitle.Contains("phi")){
axmin = -TMath::Pi();
axmax = TMath::Pi();
ndiv = 510;
} else {
std::cout<<"unrecongnized variable";
}
meanplots[i]->GetXaxis()->SetLabelOffset(999);
meanplots[i]->GetXaxis()->SetTickLength(0);
// Redraw the new axis
gPad->Update();
TGaxis *newaxis = new TGaxis(gPad->GetUxmin(),gPad->GetUymin(),
gPad->GetUxmax(),gPad->GetUymin(),
axmin,
axmax,
//meanplots[i]->GetXaxis()->GetXmin(),
//meanplots[i]->GetXaxis()->GetXmax(),
ndiv,"SDH");
TGaxis *newaxisup = new TGaxis(gPad->GetUxmin(),gPad->GetUymax(),
gPad->GetUxmax(),gPad->GetUymax(),
axmin,
axmax,
//meanplots[i]->GetXaxis()->GetXmin(),
//meanplots[i]->GetXaxis()->GetXmax(),
ndiv,"-SDH");
newaxis->SetLabelOffset(0.02);
newaxis->SetLabelFont(42);
newaxis->SetLabelSize(.05);
newaxis->Draw();
newaxisup->SetLabelOffset(-0.02);
newaxisup->SetLabelFont(42);
newaxisup->SetLabelSize(0);
newaxisup->Draw();
if(i==0){
//meanplots[i]->GetYaxis()->SetRangeUser(absmin-safeDelta/2.,absmax+safeDelta);
std::cout<<"name is: "<< meanplots[i]->GetName() << " absmin:" <<absmin<<" absmax: "<<absmax<<" safeDelta: "<<safeDelta<<std::endl;
TString theTitle = meanplots[i]->GetName();
if( theTitle.Contains("Norm")){
meanplots[i]->GetYaxis()->SetRangeUser(std::min(-0.48,absmin-safeDelta),std::max(0.48,absmax+safeDelta));
} else {
if(!onlyBias){
meanplots[i]->GetYaxis()->SetRangeUser(absmin-safeDelta,absmax+safeDelta);
} else {
meanplots[i]->GetYaxis()->SetRangeUser(-theExtreme-(TMath::Abs(absmin)/10.),theExtreme+(TMath::Abs(absmax/10.)));
}
//meanplots[i]->GetYaxis()->SetRangeUser(-theExtreme,theExtreme);
}
meanplots[i]->Draw("e1");
if(onlyBias){
Int_t nbins = meanplots[i]->GetNbinsX();
Double_t lowedge = meanplots[i]->GetBinLowEdge(1);
Double_t highedge = meanplots[i]->GetBinLowEdge(nbins+1);
TH1F* hzero = DrawZero(meanplots[i],nbins,lowedge,highedge);
hzero->Draw("PLsame");
}
示例3: drawmat_DBD
//.........这里部分代码省略.........
hmat[ihist] = new TH1F(hname[ihist],"",nbin,xmin,xmax);
//// ensure proper errors
// hmat[ihist]->Sumw2();
hmat[ihist]->SetLineColor(color[ihist]);
hmat[ihist]->SetLineWidth(3);
hmat[ihist]->SetTitle(";#theta / degrees;X_{0}");
}
// read tree
TFile* file = new TFile ( FILEN ) ;
TTree* tree = (TTree *) file->Get("ntuple");
if (!tree) {
cout << "ERROR: Couldn't open tree ntuple on file: "<< FILEN << endl;
return 1;
}
tree->SetBranchAddress("itheta", &itheta);
tree->SetBranchAddress("nrecal", &nrecal);
tree->SetBranchAddress("nrset", &nrset);
tree->SetBranchAddress("nrtpc", &nrtpc);
tree->SetBranchAddress("nrtpc_i", &nrtpc_i);
tree->SetBranchAddress("nrsit", &nrsit);
tree->SetBranchAddress("nrvxd", &nrvxd);
int entries = tree->GetEntries();
cout << "tree has " << entries << " entries" << endl;
// event loop
for (int ievt = 0; ievt < entries; ++ievt) {
tree->GetEntry(ievt);
if (itheta < 4.45) continue;
hmat[0]->Fill(-itheta,nrecal);
hmat[1]->Fill(-itheta,nrset);
hmat[2]->Fill(-itheta,nrtpc);
if( itheta > 8. )
hmat[3]->Fill(-itheta,nrtpc_i);
hmat[4]->Fill(-itheta,nrsit);
hmat[5]->Fill(-itheta,nrvxd);
hmat[6]->Fill(-itheta,1);
}
// for (int ibin = 0; ibin < nbin+1; ++ibin) {
// cout << "Bin " << ibin << " has " << hmat[4]->GetBinContent(ibin) << " entries" << endl;
// }
c1 = new TCanvas("c1","c1",600,600);
bool first = true ;
#define _include_Ecal 0
#if _include_Ecal
for (int ihist = 0; ihist < nhist-1; ihist++) {
#else
for (int ihist = 1; ihist < nhist-1; ihist++) {
#endif
// average double counts
hmat[ihist]->Divide( hmat[nhist-1] );
if( first ) {
hmat[ihist]->Draw( "" );
// --------- change axis labels from minus to plus --------
c1->Update() ;
TF1 *f1 = new TF1("f1","-x",0,90);
hmat[ihist]->GetXaxis()->SetLabelOffset(99);
Double_t x_min = c1->GetUxmin();
Double_t x_max = c1->GetUxmax();
Double_t y_min = c1->GetUymin();
//std::cout << "x_min " << x_min << " x_max " << x_max << " y_min " << y_min << std::endl ;
TGaxis *axis = new TGaxis( x_min, y_min, x_max, y_min, "f1", 5);
axis->SetLabelSize( 0.06 );
axis->SetLabelFont( 42 );
axis->Draw();
// -----end: change axis labels from minus to plus --------
first = false ;
} else {
hmat[ihist]->Draw( "same" );
}
leg->AddEntry(hmat[ihist],htitle[ihist],"L");
}
leg->Draw();
std::string pdfFile( std::string( FILEN ) + std::string( ".pdf" ) ) ;
c1->Print( pdfFile.c_str() ) ;
}
示例4: if
//.........这里部分代码省略.........
double alpha = arg->isQuickhack(12) ? 0.4 : 1.;
if ( arg->isQuickhack(24) ) alpha = 0.;
g->SetFillColorAlpha(color,alpha);
g->SetLineStyle(1);
g->SetFillStyle( s->getFillStyle() );
}
else{
g->SetLineWidth(2);
g->SetLineStyle(s->getLineStyle());
if ( last && arg->isQuickhack(25) ) g->SetLineWidth(3);
}
if ( plotPoints ){
g->SetLineWidth(1);
g->SetMarkerColor(color);
g->SetMarkerStyle(8);
g->SetMarkerSize(0.6);
if(CLsType==1) {
g->SetMarkerStyle(33);
g->SetMarkerSize(1);
}
if(CLsType==2) {
g->SetMarkerStyle(21);
}
}
// build a histogram which holds the axes
float min = arg->scanrangeMin == arg->scanrangeMax ? hCL->GetXaxis()->GetXmin() : arg->scanrangeMin;
float max = arg->scanrangeMin == arg->scanrangeMax ? hCL->GetXaxis()->GetXmax() : arg->scanrangeMax;
TH1F *haxes = new TH1F("haxes"+getUniqueRootName(), "", 100, min, max);
haxes->SetStats(0);
haxes->GetXaxis()->SetTitle(s->getScanVar1()->GetTitle());
haxes->GetYaxis()->SetTitle("1-CL");
haxes->GetXaxis()->SetLabelFont(font);
haxes->GetYaxis()->SetLabelFont(font);
haxes->GetXaxis()->SetTitleFont(font);
haxes->GetYaxis()->SetTitleFont(font);
haxes->GetXaxis()->SetTitleOffset(0.9);
haxes->GetYaxis()->SetTitleOffset(0.85);
haxes->GetXaxis()->SetLabelSize(labelsize);
haxes->GetYaxis()->SetLabelSize(labelsize);
haxes->GetXaxis()->SetTitleSize(titlesize);
haxes->GetYaxis()->SetTitleSize(titlesize);
int xndiv = arg->ndiv==-1 ? 407 : abs(arg->ndiv);
bool optimizeNdiv = arg->ndiv<0 ? true : false;
haxes->GetXaxis()->SetNdivisions(xndiv, optimizeNdiv);
haxes->GetYaxis()->SetNdivisions(407, true);
// plot y range
float plotYMax;
float plotYMin;
if ( plotLegend && !arg->isQuickhack(22) ) {
if ( arg->plotlog ) { plotYMin = 1.e-3; plotYMax = 10.; }
else { plotYMin = 0.0 ; plotYMax = 1.3; }
}
else {
if ( arg->plotlog ) { plotYMin = 1.e-3; plotYMax = 1.0; }
else { plotYMin = 0.0 ; plotYMax = 1.0; }
}
// change if passed as option
plotYMin = arg->plotymin > 0. ? arg->plotymin : plotYMin;
plotYMax = arg->plotymax > 0. ? arg->plotymax : plotYMax;
haxes->GetYaxis()->SetRangeUser( plotYMin, plotYMax );
haxes->Draw("axissame");
g->SetHistogram(haxes);
示例5: PlotPotential2D
//.........这里部分代码省略.........
PlasmaGlob::CanvasAsymPartition(C,2,lMargin,rMargin,bMargin,tMargin,factor);
TPad *pad[2];
TString sLabels[] = {"(a)","(b)"};
// Text objects
TPaveText **textLabel = new TPaveText*[2];
C->cd(0);
char pname[16];
sprintf(pname,"pad_%i",1);
pad[0] = (TPad*) gROOT->FindObject(pname);
pad[0]->Draw();
pad[0]->cd(); // <---------------------------------------------- Top Plot ---------
if(opt.Contains("logz")) {
pad[0]->SetLogz(1);
} else {
pad[0]->SetLogz(0);
}
pad[0]->SetFrameLineWidth(3);
pad[0]->SetTickx(1);
// Re-range:
for(Int_t i=0; i<Nspecies; i++) {
if(!hDen2D[i]) continue;
hDen2D[i]->GetYaxis()->SetRangeUser(yMin -(factor-1)*yRange, yMax);
}
TH2F *hFrame = (TH2F*) gROOT->FindObject("hFrame1");
if(hFrame) delete hFrame;
hFrame = (TH2F*) hDen2D[0]->Clone("hFrame1");
hFrame->Reset();
hFrame->SetLabelFont(42,"xyz");
hFrame->SetTitleFont(42,"xyz");
hFrame->GetYaxis()->SetNdivisions(505);
hFrame->GetYaxis()->SetLabelSize(0.085);
hFrame->GetYaxis()->SetTitleSize(0.09);
hFrame->GetYaxis()->SetTitleOffset(0.7);
hFrame->GetYaxis()->SetTickLength(0.02);
hFrame->GetXaxis()->SetLabelOffset(999.);
hFrame->GetXaxis()->SetTitleOffset(999.);
hFrame->GetXaxis()->SetTickLength(0.04);
// Frame asymmetry:
hFrame->Draw("col");
// hDen2D[0]->GetZaxis()->SetNdivisions(505);
// Injected electrons if any
if(Nspecies>=3) {
if(hDen2D[2]) {
exHot->Draw();
hDen2D[2]->Draw("colz same");
}
}
// Plasma
hDen2D[0]->GetZaxis()->SetTitleFont(42);
exPlasma->Draw();
hDen2D[0]->Draw("colz same");
// Beam driver.
if(hDen2D[1]) {
示例6: ZinvEstimate
//.........这里部分代码省略.........
legP->AddEntry(gr_estimated,"Estimated(from #gamma +Jets)","P");
char TMgname1[100];
TMultiGraph *TMg_1D[2];
for(int k0=0;k0<2;k0++){
sprintf(TMgname1,"TMg_1D%i",k0);
TMg_1D[k0]=new TMultiGraph();
}
for(int j0=0;j0<2;j0++){
TMg_1D[j0]->SetMinimum(0.01);
TMg_1D[j0]->SetMaximum(2000);
}
TMg_1D[0]->SetTitle(" ;ith Bin ; Events ");
TMg_1D[0]->Add(gr_mcPred);
TMg_1D[0]->Add(gr_estimated);
TMg_1D[0]->Draw("AP");
TMg_1D[0]->GetXaxis()->SetLimits(0.5,18.5);
tpa->Draw();
pCMS->Draw();
legP->Draw();
TGaxis *axis = new TGaxis( -5, 20, -5, 220, 20,220,510,"");
axis->SetLabelFont(43); // Absolute font size in pixel (precision 3)
axis->SetLabelSize(15);
axis->Draw();
cPredVsEstimated->cd();
TPad *pad2 = new TPad("pad2", "pad2", 0, 0.05, 1, 0.3);
pad2->SetTopMargin(0);
pad2->SetBottomMargin(0.2);
pad2->SetGridy(); // vertical grid
pad2->Draw();
pad2->cd(); // pad2 becomes the current pad
TH1F *h3 = (TH1F*)h_NZinv18binC->Clone("h3");
h3->SetLineColor(kBlack);
h3->SetMinimum(-1); // Define Y ..
h3->SetMaximum(3); // .. range
h3->Sumw2();
h3->SetStats(0); // No statistics on lower plot
h3->Divide(ZinvEstimate);
h3->SetMarkerStyle(21);
h3->SetMarkerColor(1);
h3->Draw("ep"); // Draw the r
h3->GetXaxis()->SetTitle("ith Bin"); // Remove the ratio title
// Y axis ratio plot settings
h3->GetYaxis()->SetTitle("Pred/Est");
h3->GetYaxis()->SetNdivisions(505);
h3->GetYaxis()->SetTitleSize(20);
示例7: drawintlen_DBD
//.........这里部分代码省略.........
// int color[nhist] = {9,8,2,38,1};
int color[nhist] = {8,2,38,1,9};
TString option[nhist];
option[0] = "same";
option[1] = "same";
option[2] = "";
option[3] = "";
option[4] = "";
// TLegend *leg = new TLegend (0.25, 0.6, 0.5, 0.85);
TLegend *leg = new TLegend (0.25, 0.3, 0.6, 0.55);
leg->SetFillStyle(0);
// stuff for histograms
TH1F* hmat[nhist];
for (int ihist = 0; ihist < nhist; ihist++) {
hmat[ihist] = new TH1F(hname[ihist],"",nbin,xmin,xmax);
//// ensure proper errors
// hmat[ihist]->Sumw2();
hmat[ihist]->SetLineColor(color[ihist]);
hmat[ihist]->SetLineWidth(3);
hmat[ihist]->SetTitle(";#theta / degrees;Interaction Lengths");
}
// read tree
TFile* file = new TFile ( FILEN ) ;
TTree* tree = (TTree *) file->Get("ntuple");
if (!tree) {
cout << "ERROR: Couldn't open tree ntuple on file: "<< FILEN << endl;
return 1;
}
tree->SetBranchAddress("theta", &theta);
tree->SetBranchAddress("thedeg",&thedeg);
tree->SetBranchAddress("nlset", &nlset);
tree->SetBranchAddress("nlecal", &nlecal);
tree->SetBranchAddress("nlhcal", &nlhcal);
tree->SetBranchAddress("nlcoil", &nlcoil);
tree->SetBranchAddress("nlyoke", &nlyoke);
int entries = tree->GetEntries();
cout << "tree has " << entries << " entries" << endl;
// event loop
for (int ievt = 0; ievt < entries; ++ievt) {
tree->GetEntry(ievt);
//, if (thedeg < 4.41) continue; // ???
hmat[0]->Fill(-thedeg,nlecal);
hmat[1]->Fill(-thedeg,nlhcal);
hmat[2]->Fill(-thedeg,nlcoil);
hmat[3]->Fill(-thedeg,nlyoke);
hmat[4]->Fill(-thedeg,1);
}
// for (int ibin = 0; ibin < nbin+1; ++ibin) {
// cout << "Bin " << ibin << " has " << hmat[4]->GetBinContent(ibin) << " entries" << endl;
// }
c1 = new TCanvas("c1","c1",600,600);
hmat[2]->GetYaxis()->SetRangeUser(0.,14.) ;
// for (int ihist = 0; ihist < nhist-2; ihist++) {
for (int ihist = nhist-3 ; ihist >=0 ; --ihist) {
// average double counts
hmat[ihist]->Divide( hmat[4] ) ;
// draw
hmat[ihist]->Draw(option[ihist]);
if( ihist == nhist-3 ){
c1->Update() ;
TF1 *f1 = new TF1("f1","-x",0,90);
hmat[ihist]->GetXaxis()->SetLabelOffset(99);
Double_t x_min = c1->GetUxmin();
Double_t x_max = c1->GetUxmax();
Double_t y_min = c1->GetUymin();
//std::cout << "x_min " << x_min << " x_max " << x_max << " y_min " << y_min << std::endl ;
TGaxis *axis = new TGaxis( x_min, y_min, x_max, y_min, "f1", 5);
axis->SetLabelSize( 0.06 );
axis->SetLabelFont( 42 );
axis->Draw();
}
leg->AddEntry(hmat[ihist],htitle[ihist],"L");
}
leg->Draw();
std::string pdfFile( std::string( FILEN ) + std::string( ".pdf" ) ) ;
c1->Print( pdfFile.c_str() ) ;
}