本文整理汇总了C++中TGaxis::SetLabelOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ TGaxis::SetLabelOffset方法的具体用法?C++ TGaxis::SetLabelOffset怎么用?C++ TGaxis::SetLabelOffset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGaxis
的用法示例。
在下文中一共展示了TGaxis::SetLabelOffset方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: ReverseXAxis
void ReverseXAxis (TH1 *h)
{
h->GetXaxis()->SetLabelOffset(999);
h->GetXaxis()->SetTickLength(0);
gPad->Update();
TGaxis *newaxis = new TGaxis(gPad->GetUxmax(),
gPad->GetUymin(),
gPad->GetUxmin(),
gPad->GetUymin(),
h->GetXaxis()->GetXmin(),
h->GetXaxis()->GetXmax(),
510,"-");
newaxis->SetLabelOffset(-0.03);
newaxis->SetTitle("X[cm]");
newaxis->CenterTitle(1);
newaxis->Draw();
}
示例3: anotherScale
ExtraAxis anotherScale (const TH1* refHist, double scale, int color, const char* title, double offset) {
ExtraAxis result;
double x0 = refHist->GetXaxis()->GetXmin();
double x1 = refHist->GetXaxis()->GetXmax();
double y0 = refHist->GetMinimum();
double y1 = refHist->GetMaximum();
// double y0 = refHist->GetYaxis()->GetXmin();
// double y1 = refHist->GetYaxis()->GetXmax();
double xoffset = exp (log(x0) - (log(x1) - log(x0))*offset);
TGaxis* axis = new TGaxis(xoffset, y0, xoffset, y1, y0*scale,y1*scale,510,"-GS");
axis->ImportAxisAttributes (refHist->GetXaxis());
axis->SetTitle(title);
axis->SetTextColor (color);
axis->SetLineColor (color);
axis->SetLineWidth (1);
axis->SetTextColor (color);
axis->SetLabelColor (color);
axis->SetLabelOffset (0.);
axis->SetTitleOffset (0.65);
axis->SetTickSize(0.015);
result.Add (axis);
TLine* line = new TLine (xoffset, y0, xoffset, y1);
line->SetLineColor (color);
line->SetLineWidth (2);
result.Add (line);
line = new TLine (x0, y0, xoffset, y0);
line->SetLineColor (kGray);
line->SetLineWidth (2);
result.Add (line);
line = new TLine (x0, y1, xoffset, y1);
line->SetLineColor (kGray);
line->SetLineWidth (2);
result.Add (line);
return result;
}
示例4: arrangeCanvas
//.........这里部分代码省略.........
canv->cd();
}
Double_t absmin(999.);
Double_t absmax(-999.);
for(Int_t i=0; i<nFiles; i++){
if(meanplots[i]->GetMaximum()>absmax) absmax = meanplots[i]->GetMaximum();
if(meanplots[i]->GetMinimum()<absmin) absmin = meanplots[i]->GetMinimum();
}
Double_t safeDelta=(absmax-absmin)/2.;
Double_t theExtreme=std::max(absmax,TMath::Abs(absmin));
for(Int_t i=0; i<nFiles; i++){
TString myTitle = meanplots[i]->GetName();
float axmin = -999;
float axmax = 999.;
int ndiv = 510;
if(myTitle.Contains("eta")){
axmin = -2.5;
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){
示例5: PlotPotential2D
//.........这里部分代码省略.........
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]) {
// hDen2D[1]->GetZaxis()->SetNdivisions(505);
exElec->Draw();
hDen2D[1]->Draw("colz same");
}
{
TGraph *gr = (TGraph*) graphsV2D.At(4);
gr->Draw("C");
}
示例6: PlotField1D
//.........这里部分代码省略.........
if(yEMaxPos[i][j]>maxPhase)
maxPhase = yEMaxPos[i][j];
if(yEMaxPos[i][j]<minPhase)
minPhase = yEMaxPos[i][j];
if(yEMaxValue[i][j]>maxField)
maxField = yEMaxValue[i][j];
if(yEMaxValue[i][j]<minField)
minField = yEMaxValue[i][j];
}
}
Float_t margin = (maxPhase - minPhase)/10;
gEMaxPos[0]->GetYaxis()->SetRangeUser(minPhase-margin,maxPhase+margin);
gEMaxPos[0]->GetYaxis()->CenterTitle();
gEMaxPos[0]->GetXaxis()->CenterTitle();
gEMaxPos[0]->SetLineColor(phaseC);
gEMaxPos[0]->SetMarkerColor(phaseC);
gEMaxPos[0]->SetLineWidth(3);
gEMaxPos[0]->SetMarkerStyle(20);
gEMaxPos[0]->SetMarkerSize(1.4);
gEMaxPos[0]->Draw("APC");
if(Nfields>1) {
gEMaxPos[1]->SetLineStyle(1);
gEMaxPos[1]->SetLineColor(phaseC);
gEMaxPos[1]->SetMarkerColor(phaseC);
gEMaxPos[1]->SetLineWidth(1);
gEMaxPos[1]->SetMarkerStyle(24);
gEMaxPos[1]->SetMarkerSize(1.4);
gEMaxPos[1]->Draw("PC");
}
// Emax value
// New axis first:
C->Update(); // Needed for the axis!
margin = (maxField - minField)/10;
if (margin==0) margin = 1;
Float_t rightmin = minField-margin;
Float_t rightmax = maxField+margin;
Float_t slope = (gPad->GetUymax() - gPad->GetUymin())/(rightmax-rightmin);
TGaxis *axisEmax = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(),gPad->GetUxmax(),
gPad->GetUymax(),rightmin,rightmax,505,"+L");
axisEmax->SetLineWidth(1);
axisEmax->SetLineColor(fieldC);
axisEmax->SetLabelColor(fieldC);
axisEmax->SetTitleColor(fieldC);
if(opt.Contains("units") && n0)
axisEmax->SetTitle("E_{min} [GV/m]");
else
axisEmax->SetTitle("E_{min} [E_{0}]");
axisEmax->CenterTitle();
axisEmax->SetTitleSize(0.05);
axisEmax->SetTitleOffset(1.2);
axisEmax->SetLabelSize(0.05);
axisEmax->SetLabelOffset(0.006);
axisEmax->Draw();
// Adjust the TGraph
Double_t *x = gEMaxValue[0]->GetX();
Double_t *y = gEMaxValue[0]->GetY();
for(Int_t i=0;i<gEMaxValue[0]->GetN();i++) {
gEMaxValue[0]->SetPoint(i,x[i],(y[i]-rightmin)*slope + gPad->GetUymin());
}
gEMaxValue[0]->SetLineColor(fieldC);
gEMaxValue[0]->SetMarkerColor(fieldC);
gEMaxValue[0]->SetLineWidth(3);
gEMaxValue[0]->SetMarkerStyle(20);
gEMaxValue[0]->SetMarkerSize(1.4);
gEMaxValue[0]->Draw("PC");
if(Nfields>1) {
x = gEMaxValue[1]->GetX();
y = gEMaxValue[1]->GetY();
for(Int_t i=0;i<gEMaxValue[1]->GetN();i++) {
gEMaxValue[1]->SetPoint(i,x[i],(y[i]-rightmin)*slope + gPad->GetUymin());
}
gEMaxValue[1]->SetLineColor(fieldC);
gEMaxValue[1]->SetMarkerColor(fieldC);
gEMaxValue[1]->SetLineWidth(1);
gEMaxValue[1]->SetMarkerStyle(24);
gEMaxValue[1]->SetMarkerSize(1.4);
gEMaxValue[1]->Draw("PC");
}
// Emax value
// New axis first:
C->Update(); // Needed for the axis!
C->cd();
ifile->Close();
// Print to a file
PlasmaGlob::imgconv(C,fOutName,opt);
// ---------------------------------------------------------
}