本文整理汇总了C++中TAxis::SetTitleSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TAxis::SetTitleSize方法的具体用法?C++ TAxis::SetTitleSize怎么用?C++ TAxis::SetTitleSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TAxis
的用法示例。
在下文中一共展示了TAxis::SetTitleSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TH2* RootWriter::CreateTH2(Histogram2D* h)
{
const Axis& xax = h->GetAxisX(), yax = h->GetAxisY();
const int xchannels = xax.GetBinCount();
const int ychannels = yax.GetBinCount();
TH2* mat = new TH2F( h->GetName().c_str(), h->GetTitle().c_str(),
xchannels, xax.GetLeft(), xax.GetRight(),
ychannels, yax.GetLeft(), yax.GetRight() );
mat->SetOption( "colz" );
mat->SetContour( 64 );
TAxis* rxax = mat->GetXaxis();
rxax->SetTitle(xax.GetTitle().c_str());
rxax->SetTitleSize(0.03);
rxax->SetLabelSize(0.03);
TAxis* ryax = mat->GetYaxis();
ryax->SetTitle(yax.GetTitle().c_str());
ryax->SetTitleSize(0.03);
ryax->SetLabelSize(0.03);
ryax->SetTitleOffset(1.3);
TAxis* zax = mat->GetZaxis();
zax->SetLabelSize(0.025);
for(int iy=0; iy<ychannels+2; ++iy)
for(int ix=0; ix<xchannels+2; ++ix)
mat->SetBinContent(ix, iy, h->GetBinContent(ix, iy));
mat->SetEntries( h->GetEntries() );
return mat;
}
示例2: SetAxis
//------------------------------------------------------------------------------
// SetAxis
//------------------------------------------------------------------------------
void SetAxis(TH1* hist,
TString xtitle,
TString ytitle,
Float_t size,
Float_t offset)
{
TAxis* xaxis = (TAxis*)hist->GetXaxis();
TAxis* yaxis = (TAxis*)hist->GetYaxis();
xaxis->SetLabelFont(42);
yaxis->SetLabelFont(42);
xaxis->SetTitleFont(42);
yaxis->SetTitleFont(42);
xaxis->SetLabelOffset(0.025);
yaxis->SetLabelOffset(0.025);
xaxis->SetTitleOffset(1.4);
yaxis->SetTitleOffset(offset);
xaxis->SetLabelSize(size);
yaxis->SetLabelSize(size);
xaxis->SetTitleSize(size);
yaxis->SetTitleSize(size);
xaxis->SetTitle(xtitle);
yaxis->SetTitle(ytitle);
xaxis->SetNdivisions(505);
yaxis->SetNdivisions(505);
yaxis->CenterTitle();
gPad->GetFrame()->DrawClone();
gPad->RedrawAxis();
}
示例3: residual_error
/*
double residual_error( double error_data, double pdf )
{
double chi2 = 0.;
if ( pdf > 0 )
chi2 += 2. * ( pdf - error_data );
if ( error_data > 0 && pdf > 0 )
chi2=(error_data/pdf);
//chi2 += 2. * error_data * log( error_data / error_pdf );
// return ( ( error_data >= pdf ) ? sqrt( chi2 ) : -sqrt( chi2 ) );
// return ( ( error_data >= pdf ) ? chi2 : chi2 );
return ( chi2 );
}
*/
TH1D* residualHist( const RooHist* rhist, const RooCurve* curve )
{
double r = 0.2;
double sr = 1. / r;
// Grab info from the histogram.
int n = rhist->GetN();
double* x = rhist->GetX();
double* y = rhist->GetY();
//rhist->Sumw2();
// double e;
// Create residual histogram.
double xMin = x[ 0 ];
double xMax = x[ n - 1 ];
TH1D* residuals_temp = new TH1D( "r", "", n, xMin, xMax );
double datum = 0.;
double pdf = 0.;
double error_data = 0.;
// Fill the histogram.
if ( curve )
for ( int bin = 0; bin < n; bin++ )
{
datum = y[ bin ];
pdf = curve->Eval( x[ bin ] );
error_data = rhist->GetErrorY(bin);
// error_pdf = curve->Eval( x[ bin ] );
residuals_temp->SetBinContent( bin + 1, residual( datum, pdf ) );
// residuals_temp->SetBinError ( bin + 1, residual_error( error_data, pdf ) );
residuals_temp->SetBinError ( bin + 1, error_data / pdf );
}
residuals_temp->SetMinimum ( -2. );
residuals_temp->SetMaximum ( 2. );
residuals_temp->SetStats ( false );
residuals_temp->SetMarkerStyle( 8 );
residuals_temp->SetMarkerSize ( .8 );
TAxis* xAxis = residuals_temp->GetXaxis();
xAxis->SetTickLength ( sr * xAxis->GetTickLength() );
xAxis->SetLabelSize ( sr * xAxis->GetLabelSize() );
xAxis->SetTitleSize ( sr * xAxis->GetTitleSize() );
xAxis->SetLabelOffset( sr * xAxis->GetLabelOffset() );
TAxis* yAxis = residuals_temp->GetYaxis();
//yAxis->SetNdivisions ( 500 );
//yAxis->SetLabelSize ( 10*sr * yAxis->GetLabelSize() );
yAxis->SetLabelSize ( 2.5 * yAxis->GetLabelSize() );
yAxis->SetTitle(" (DATA - FIT) / FIT");
yAxis->SetTitleSize ( 0.09 );
yAxis->SetTitleOffset( 0.35 );
return residuals_temp;
}
示例4: showGraph
void showGraph(double canvasSizeX, double canvasSizeY,
TGraph* graph,
bool useLogScaleX, double xMin, double xMax, const std::string& xAxisTitle, double xAxisOffset,
bool useLogScaleY, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
const std::string& outputFileName)
{
TCanvas* canvas = new TCanvas("canvas", "canvas", canvasSizeX, canvasSizeY);
canvas->SetFillColor(10);
canvas->SetBorderSize(2);
canvas->SetTopMargin(0.05);
canvas->SetLeftMargin(0.19);
canvas->SetBottomMargin(0.19);
canvas->SetRightMargin(0.05);
canvas->SetLogx(useLogScaleX);
canvas->SetLogy(useLogScaleY);
TH1* dummyHistogram = new TH1D("dummyHistogram", "dummyHistogram", 10, xMin, xMax);
dummyHistogram->SetTitle("");
dummyHistogram->SetStats(false);
dummyHistogram->SetMinimum(yMin);
dummyHistogram->SetMaximum(yMax);
dummyHistogram->Draw("axis");
TAxis* xAxis = dummyHistogram->GetXaxis();
xAxis->SetTitle(xAxisTitle.data());
xAxis->SetTitleOffset(xAxisOffset);
xAxis->SetTitleSize(0.065);
xAxis->SetLabelSize(0.055);
xAxis->SetLabelOffset(0.01);
xAxis->SetTickLength(0.055);
xAxis->SetNdivisions(505);
TAxis* yAxis = dummyHistogram->GetYaxis();
yAxis->SetTitle(yAxisTitle.data());
yAxis->SetTitleOffset(yAxisOffset);
yAxis->SetTitleSize(0.070);
yAxis->SetLabelSize(0.055);
yAxis->SetLabelOffset(0.01);
yAxis->SetTickLength(0.055);
yAxis->SetNdivisions(505);
graph->SetMarkerColor(1);
graph->SetLineColor(1);
graph->Draw("p");
canvas->Update();
size_t idx = outputFileName.find_last_of('.');
std::string outputFileName_plot = std::string(outputFileName, 0, idx);
if ( useLogScaleY ) outputFileName_plot.append("_log");
else outputFileName_plot.append("_linear");
if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
canvas->Print(std::string(outputFileName_plot).append(".png").data());
//canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
//canvas->Print(std::string(outputFileName_plot).append(".root").data());
delete dummyHistogram;
delete canvas;
}
示例5: showHistograms
void showHistograms(double canvasSizeX, double canvasSizeY,
TH1* histogram,
double xMin, double xMax, const std::string& xAxisTitle, double xAxisOffset,
bool useLogScale, double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
const std::string& outputFileName)
{
TCanvas* canvas = new TCanvas("canvas", "canvas", canvasSizeX, canvasSizeY);
canvas->SetFillColor(10);
canvas->SetBorderSize(2);
canvas->SetLeftMargin(0.15);
canvas->SetBottomMargin(0.15);
canvas->SetLogy(useLogScale);
histogram->SetTitle("");
histogram->SetStats(true);
histogram->SetMinimum(yMin);
histogram->SetMaximum(yMax);
histogram->SetLineColor(1);
histogram->SetLineWidth(2);
histogram->SetMarkerColor(1);
histogram->SetMarkerStyle(20);
histogram->SetMarkerSize(1.5);
histogram->Draw("hist");
TAxis* xAxis = histogram->GetXaxis();
xAxis->SetRangeUser(xMin, xMax);
xAxis->SetTitle(xAxisTitle.data());
xAxis->SetTitleSize(0.060);
xAxis->SetTitleOffset(xAxisOffset);
xAxis->SetLabelSize(0.050);
xAxis->SetNdivisions(505);
TAxis* yAxis = histogram->GetYaxis();
yAxis->SetTitle(yAxisTitle.data());
yAxis->SetTitleSize(0.060);
yAxis->SetTitleOffset(yAxisOffset);
yAxis->SetLabelSize(0.050);
yAxis->SetNdivisions(505);
canvas->Update();
size_t idx = outputFileName.find_last_of('.');
std::string outputFileName_plot = std::string(outputFileName, 0, idx);
if ( useLogScale ) outputFileName_plot.append("_log");
else outputFileName_plot.append("_linear");
if ( idx != std::string::npos ) canvas->Print(std::string(outputFileName_plot).append(std::string(outputFileName, idx)).data());
//canvas->Print(std::string(outputFileName_plot).append(".png").data());
canvas->Print(std::string(outputFileName_plot).append(".pdf").data());
//canvas->Print(std::string(outputFileName_plot).append(".root").data());
delete canvas;
}
示例6: PrettyFonts
void PrettyFonts(TH1D* h){
TAxis * x = h->GetXaxis();
TAxis * y = h->GetYaxis();
x->SetTitleFont(132);
y->SetTitleFont(132);
x->SetTitleSize(0.06);
x->SetTitleOffset(1.05); //make the Title a little further from the axis
y->SetTitleOffset(1.05);
y->SetTitleSize(0.06);
x->SetLabelFont(132);
y->SetLabelFont(132);
x->SetLabelSize(0.06);
y->SetLabelSize(0.06);
}
示例7: plotPair
//==========================================
//==========================================
void plotPair(TH1F *h1,TH1F *h0 ) {
h1->Draw();
// edit fonts/sizes
TAxis *ax =h1->GetYaxis();
float ss=ax->GetTitleSize();
//printf("ss=%f\n",ss);
ax->SetTitleSize(2*ss);
ax->SetTitleOffset(0.5);
ax =h1->GetXaxis();
ax->SetTitleSize(1.5*ss);
ax->SetLabelSize(1.5*ss);
ax->SetTitleOffset(0.7);
// edit fonts/sizes DONE
gPad->Update();
//scale hint1 to the pad coordinates
Float_t rightmax = 1.1*h0->GetMaximum();
Float_t scale = gPad->GetUymax()/rightmax;
h0->Scale(scale);
h0->Draw("same");
//draw an axis on the right side
TGaxis *axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),
gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,510,"-R");
int col=h0->GetLineColor();
axis->SetLineColor(col);
axis->SetTextColor(col);
axis->SetLabelColor(col);
axis ->SetTitle("LCP yield");
axis->SetTitleSize(2*ss);
axis->SetTitleOffset(.5);
axis->Draw();
TPaveStats *st =( TPaveStats *)gPad->GetPrimitive("stats");
st->SetX1NDC(0.35);
st->SetX2NDC(0.5);
st->SetY1NDC(0.7);
st->SetY2NDC(1.);
}
示例8: DrawOne
THStack* DrawOne(TVirtualPad* p,
Double_t yr,
Bool_t top,
TDirectory* dir,
const char* name)
{
p->cd();
p->SetFillColor(0);
p->SetFillStyle(0);
p->SetLineColor(0);
p->SetRightMargin(0.01);
p->SetLeftMargin(0.12);
p->SetGridx();
if (top) p->SetBottomMargin(0.001);
else p->SetBottomMargin(0.2);
if (top) p->SetTopMargin(0.02);
else p->SetTopMargin(0.0001);
THStack* s = static_cast<THStack*>(dir->Get(name));
s->Draw("nostack");
Double_t sc = (top ? 1-yr : yr);
TAxis* ya = s->GetHistogram()->GetYaxis();
ya->SetLabelSize(1/sc*ya->GetLabelSize());
ya->SetTitleSize(1/sc*ya->GetTitleSize());
ya->SetTitleOffset(sc*(ya->GetTitleOffset()+.5));
ya->SetTitleFont(42);
ya->SetLabelFont(42);
TAxis* xa = s->GetHistogram()->GetXaxis();
xa->SetLabelSize(!top ? 1/yr*xa->GetLabelSize() : 0);
xa->SetTitleSize(!top ? 1/yr*xa->GetTitleSize() : 0);
xa->SetTitleOffset(yr*(xa->GetTitleOffset()+2));
xa->SetTitleFont(42);
xa->SetLabelFont(42);
p->Modified();
p->Update();
p->cd();
return s;
}
示例9: SetAxisLabels
void SetAxisLabels(TH1& hist, char* xtitle, char* ytitle="",
double xoffset=1.1, double yoffset=1.4) {
TAxis* x = hist.GetXaxis();
TAxis* y = hist.GetYaxis();
x->SetTitle(xtitle);
x->SetTitleSize(0.06);
x->SetLabelSize(0.05);
x->SetTitleOffset(xoffset);
x->SetNdivisions(505);
y->SetTitle(ytitle);
y->SetTitleSize(0.06);
y->SetLabelSize(0.05);
y->SetTitleOffset(yoffset);
y->SetNoExponent();
hist.SetLineWidth(2);
hist.SetMarkerStyle(20);
std::stringstream str;
str << "Events / " << (int) lumi << " pb^{-1} ";
std::string defYtitle = str.str();
if(ytitle=="") y->SetTitle( defYtitle.c_str() );
}
示例10: SetAxis
//------------------------------------------------------------------------------
// SetAxis
//------------------------------------------------------------------------------
void SetAxis(TH1* hist,
TString xtitle,
TString ytitle,
Float_t xoffset,
Float_t yoffset)
{
gPad->cd();
gPad->Update();
// See https://root.cern.ch/doc/master/classTAttText.html#T4
Float_t padw = gPad->XtoPixel(gPad->GetX2());
Float_t padh = gPad->YtoPixel(gPad->GetY1());
Float_t size = (padw < padh) ? padw : padh;
size = 20. / size; // Like this label size is always 20 pixels
TAxis* xaxis = (TAxis*)hist->GetXaxis();
TAxis* yaxis = (TAxis*)hist->GetYaxis();
xaxis->SetTitleOffset(xoffset);
yaxis->SetTitleOffset(yoffset);
xaxis->SetLabelSize(size);
yaxis->SetLabelSize(size);
xaxis->SetTitleSize(size);
yaxis->SetTitleSize(size);
xaxis->SetTitle(xtitle);
yaxis->SetTitle(ytitle);
yaxis->CenterTitle();
gPad->GetFrame()->DrawClone();
gPad->RedrawAxis();
}
示例11: setHist
void LEPStyle::setHist()
{
_hist = new TH1F( "bidon", "bidon", 100, _xmin, _xmax );
_ax = _hist->GetXaxis();
_ay = _hist->GetYaxis();
_ax->SetTitle(_title);
_ax->SetNdivisions(_ndivx);
if( _logX )
{
_ax->SetMoreLogLabels();
}
_ax->SetLabelSize(_scale*0.060);
// _ax->SetLabelOffset(_scale*0.007);
_ax->SetTitleSize(_scale*0.070);
_ax->SetTitleOffset(0.9);
_ax->CenterTitle( _centerTitle );
_ay->SetNdivisions(0);
}
示例12: drawFigure7
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// drawFigure7
//
// parameter = "dg0"
// parameter = "lam0"
// parameter = "dk0"
//
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void drawFigure7(TString parameter = "dk0")
{
gInterpreter->ExecuteMacro("WZPaperStyle.C");
gSystem->mkdir("pdf", kTRUE);
gSystem->mkdir("png", kTRUE);
// Individual settings
//----------------------------------------------------------------------------
if (parameter.Contains("dg0"))
{
xtitle = "#Delta#kappa^{Z}";
ytitle = "#lambda";
xmin = -0.5;
xmax = 0.5;
ymin = -0.039;
ymax = 0.053;
}
else if (parameter.Contains("lam0"))
{
xtitle = "#Delta#kappa^{Z}";
ytitle = "#Deltag^{Z}_{1}";
xmin = -0.53;
xmax = 0.53;
ymin = -0.05;
ymax = 0.09;
}
else if (parameter.Contains("dk0"))
{
xtitle = "#Deltag^{Z}_{1}";
ytitle = "#lambda";
xmin = -0.059;
xmax = 0.059;
ymin = -0.037;
ymax = 0.052;
}
// Read the input file
//----------------------------------------------------------------------------
TFile* file = new TFile("rootfiles/contours_" + parameter + "_2Dpol2.root", "read");
TGraph* cont_exp_68 = (TGraph*)file->Get("cont_exp_68");
TGraph* cont_exp_95 = (TGraph*)file->Get("cont_exp_95");
TGraph* cont_exp_99 = (TGraph*)file->Get("cont_exp_99");
TGraph* cont_obs_95 = (TGraph*)file->Get("cont_obs_95");
TGraph* bestFit = (TGraph*)file->Get("bestFit");
bestFit->SetMarkerSize(1.5);
bestFit->SetMarkerStyle(34);
TGraph* g_large = new TGraph(2);
g_large->SetPoint(0, -1.0, 1.0);
g_large->SetPoint(1, 1.0, 1.0);
// Draw
//----------------------------------------------------------------------------
TCanvas* canvas = new TCanvas("canvas", "canvas");
TMultiGraph* mg = new TMultiGraph();
mg->Add(cont_exp_68);
mg->Add(cont_exp_95);
mg->Add(cont_exp_99);
mg->Add(cont_obs_95);
mg->Add(bestFit, "p");
mg->Add(g_large);
mg->Draw("ac");
mg->SetMinimum(ymin);
mg->SetMaximum(ymax);
// Axis labels
//----------------------------------------------------------------------------
TAxis* xaxis = mg->GetXaxis();
TAxis* yaxis = mg->GetYaxis();
xaxis->SetLabelFont ( 42);
xaxis->SetLabelOffset( 0.01);
xaxis->SetLabelSize ( 0.05);
xaxis->SetNdivisions ( 505);
xaxis->SetTitle (xtitle);
xaxis->SetTitleFont ( 42);
xaxis->SetTitleOffset( 1.2);
xaxis->SetTitleSize ( 0.05);
//.........这里部分代码省略.........
示例13: makeTable
//.........这里部分代码省略.........
// TGraphAsymmErrors *g1 = new TGraphAsymmErrors();
// g1->BayesDivide(destination, base, "");
// g1->GetYaxis()->SetRangeUser(0.5, 1.05);
h0->SetMarkerStyle(20);
h1->SetMarkerStyle(20);
ScaleTo10pb( *h0 );
ScaleTo10pb( *h1 );
// TH1F* h01 = (TH1F*) myhistos->Get("fit_eff_Et");
// TH1F* h11 = (TH1F*) myhistos->Get("fit_eff_Eta");
// h01->SetMarkerColor(4);
// h01->SetLineColor(4);
// h11->SetMarkerColor(4);
// h11->SetLineColor(4);
// ScaleTo10pb( *h01 );
// ScaleTo10pb( *h11 );
TH1F* h02 = (TH1F*) myhistos->Get("truth_eff_EtDet");
TH1F* h12 = (TH1F*) myhistos->Get("truth_eff_EtaDet");
h02->SetMarkerColor(2);
h02->SetLineColor(2);
h02->SetMarkerStyle(24);
h12->SetMarkerColor(2);
h12->SetLineColor(2);
h12->SetMarkerStyle(24);
ScaleTo10pb( *h02 );
ScaleTo10pb( *h12 );
TAxis* xaxis = h0->GetXaxis();
TAxis* yaxis = h0->GetYaxis();
xaxis->SetTitle("E_{T} (GeV)");
xaxis->SetTitleSize(0.04);
xaxis->SetTitleOffset(1.3);
xaxis->SetNdivisions(505);
yaxis->SetTitle("Efficiency ");
yaxis->SetTitleSize(0.04);
yaxis->SetTitleOffset(1.6);
h0->SetMinimum(0.5);
h0->SetMaximum(1.1);
TAxis* xaxis = h1->GetXaxis();
TAxis* yaxis = h1->GetYaxis();
xaxis->SetTitle("#eta");
xaxis->SetTitleSize(0.04);
xaxis->SetTitleOffset(1.3);
xaxis->SetNdivisions(505);
yaxis->SetTitle("Efficiency ");
yaxis->SetTitleSize(0.04);
yaxis->SetTitleOffset(1.6);
h1->SetMinimum(0.5);
h1->SetMaximum(1.1);
TAxis* xaxis = h2->GetXaxis();
TAxis* yaxis = h2->GetYaxis();
xaxis->SetTitle("E_{T} (GeV)");
xaxis->SetTitleSize(0.04);
xaxis->SetTitleOffset(1.3);
xaxis->SetNdivisions(505);
yaxis->SetTitle("#eta ");
yaxis->SetTitleSize(0.04);
yaxis->SetTitleOffset(1.7);
示例14: ratio
/*
* Main Function
*/
void ratio() {
gStyle->SetFrameLineWidth(1);
//Number of Measurements
const int NUM = 2;
//Measurements and uncertainties
// mean, -stat, +stat, -syst, +syst
double m[NUM][5] = {
0.98, 0.10, 0.10, 0.14, 0.14,
//1.33, 0.32, 0.32, 0.22, 0.22
1.26, 0.37, 0.37, 0.46, 0.46
};
//Theory and uncertainties
// mean, -uncert, +uncert
double t[NUM][3] = {
1.0, 0.114, 0.114,
1.0, 0.111, 0.111
};
// label text, sub-label text
// Note: TString does not work, b/c one cannot pass an array of TStrings
// as an argument to a function
char label[NUM][2][100] = {
"Z#gamma#gamma", "",
//"W#gamma#gamma", ""
"W#gamma#gamma (#mu)", ""
};
// format:
// # color, bgColor, fontSytle, linewidth, markerStyle
int aux[NUM][5] = {
1, 10, 42, 2, 20,
1, 10, 42, 2, 20
};
// determning the x size of the plot
double lowX = LOW_X;
double uppX = UPP_X;
TH2F* lft = new TH2F("lft", "", 50, lowX, uppX, 1, 0.0, 1.0);
// height = NUM*unitHeight + 2*spacers + 1*bottomMargin + 0.5*topMargin
const double unitHeight = 50.0; // even number
const double height = (double(NUM)+2.0)*unitHeight+100.0+30.0;
// how much to step each time to cover the vertical range of the histo in
// exactly NUM+2 steps
const double vstep = unitHeight/(height-100.0-30.0);
const double width = 800.0;
printf("Canvas: width=%d, height=%d\n",
TMath::Nint(width), TMath::Nint(height));
printf("Y-step = %6.4f\n", vstep);
// Set canvas and margins
TCanvas* canvas = new TCanvas("canvas", "canvas", 200, 0,
TMath::Nint(width), TMath::Nint(height));
canvas->SetFillColor(10);
canvas->SetRightMargin(20.0/width);
canvas->SetLeftMargin(20.0/width);
canvas->SetBottomMargin(56.0/height);
canvas->SetTopMargin(30.0/height);
canvas->Draw();
canvas->cd();
//printf("TopMargin : %6.4f\n", canvas->GetTopMargin());
//printf("BottomMargin: %6.4f\n", canvas->GetBottomMargin());
TAxis* xaxis = lft->GetXaxis();
TAxis* yaxis = lft->GetYaxis();
xaxis->CenterTitle(kTRUE);
xaxis->SetTitleSize(0.07);
xaxis->SetTitleFont(62);
xaxis->SetTitleOffset(1.1);
xaxis->SetNdivisions(6,5,0);
xaxis->SetLabelOffset(0.01);
xaxis->SetLabelSize(0.05);
xaxis->SetLabelFont(42);
yaxis->SetLabelSize(0.0);
yaxis->SetNdivisions(-1);
lft->SetXTitle("Cross Section Ratio #sigma_{Exp} / #sigma_{Theory}");
lft->SetYTitle("");
lft->SetStats(kFALSE);
lft->SetTitle("");
lft->Draw();
// Draw Theory Bands
for (int i=0; i!=NUM; ++i) {
drawTheory(i, t[i][0], t[i][1], t[i][2], vstep);
//.........这里部分代码省略.........
示例15: showGraphs
void showGraphs(double canvasSizeX, double canvasSizeY,
TGraph* graph1, const std::string& legendEntry1,
TGraph* graph2, const std::string& legendEntry2,
TGraph* graph3, const std::string& legendEntry3,
TGraph* graph4, const std::string& legendEntry4,
TGraph* graph5, const std::string& legendEntry5,
TGraph* graph6, const std::string& legendEntry6,
int colors[], int markerStyles[],
double legendTextSize, double legendPosX, double legendPosY, double legendSizeX, double legendSizeY,
std::vector<std::string>& labelTextLines, double labelTextSize,
double labelPosX, double labelPosY, double labelSizeX, double labelSizeY,
double xMin, double xMax, const std::string& xAxisTitle, double xAxisOffset,
double yMin, double yMax, const std::string& yAxisTitle, double yAxisOffset,
const std::string& outputFileName)
{
TCanvas* canvas = new TCanvas("canvas", "canvas", canvasSizeX, canvasSizeY);
canvas->SetFillColor(10);
canvas->SetBorderSize(2);
canvas->SetLeftMargin(0.14);
canvas->SetBottomMargin(0.12);
TH1* dummyHistogram = new TH1D("dummyHistogram", "dummyHistogram", 100, xMin, xMax);
dummyHistogram->SetTitle("");
dummyHistogram->SetStats(false);
dummyHistogram->SetMinimum(yMin);
dummyHistogram->SetMaximum(yMax);
TAxis* xAxis = dummyHistogram->GetXaxis();
xAxis->SetTitle(xAxisTitle.data());
xAxis->SetTitleSize(0.045);
xAxis->SetTitleOffset(xAxisOffset);
TAxis* yAxis = dummyHistogram->GetYaxis();
yAxis->SetTitle(yAxisTitle.data());
yAxis->SetTitleSize(0.045);
yAxis->SetTitleOffset(yAxisOffset);
dummyHistogram->Draw("axis");
graph1->SetLineColor(colors[0]);
graph1->SetLineWidth(2);
graph1->SetMarkerColor(colors[0]);
graph1->SetMarkerStyle(markerStyles[0]);
graph1->SetMarkerSize(2);
graph1->Draw("p");
if ( graph2 ) {
graph2->SetLineColor(colors[1]);
graph2->SetLineWidth(2);
graph2->SetMarkerColor(colors[1]);
graph2->SetMarkerStyle(markerStyles[1]);
graph2->SetMarkerSize(2);
graph2->Draw("p");
}
if ( graph3 ) {
graph3->SetLineColor(colors[2]);
graph3->SetLineWidth(2);
graph3->SetMarkerColor(colors[2]);
graph3->SetMarkerStyle(markerStyles[2]);
graph3->SetMarkerSize(2);
graph3->Draw("p");
}
if ( graph4 ) {
graph4->SetLineColor(colors[3]);
graph4->SetLineWidth(2);
graph4->SetMarkerColor(colors[3]);
graph4->SetMarkerStyle(markerStyles[3]);
graph4->SetMarkerSize(2);
graph4->Draw("p");
}
if ( graph5 ) {
graph5->SetLineColor(colors[4]);
graph5->SetLineWidth(2);
graph5->SetMarkerColor(colors[4]);
graph5->SetMarkerStyle(markerStyles[4]);
graph5->SetMarkerSize(2);
graph5->Draw("p");
}
if ( graph6 ) {
graph6->SetLineColor(colors[5]);
graph6->SetLineWidth(2);
graph6->SetMarkerColor(colors[5]);
graph6->SetMarkerStyle(markerStyles[5]);
graph6->SetMarkerSize(2);
graph6->Draw("p");
}
TLegend* legend = new TLegend(legendPosX, legendPosY, legendPosX + legendSizeX, legendPosY + legendSizeY, "", "brNDC");
legend->SetBorderSize(0);
legend->SetFillColor(0);
legend->SetTextSize(legendTextSize);
legend->AddEntry(graph1, legendEntry1.data(), "p");
if ( graph2 ) legend->AddEntry(graph2, legendEntry2.data(), "p");
if ( graph3 ) legend->AddEntry(graph3, legendEntry3.data(), "p");
if ( graph4 ) legend->AddEntry(graph4, legendEntry4.data(), "p");
//.........这里部分代码省略.........