本文整理汇总了C++中TPaletteAxis::GetX1NDC方法的典型用法代码示例。如果您正苦于以下问题:C++ TPaletteAxis::GetX1NDC方法的具体用法?C++ TPaletteAxis::GetX1NDC怎么用?C++ TPaletteAxis::GetX1NDC使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPaletteAxis
的用法示例。
在下文中一共展示了TPaletteAxis::GetX1NDC方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: correlations
// input: - Input file (result from TMVA),
// - use of colors or grey scale
// - use of TMVA plotting TStyle
void correlations( TString fin = "TMVA.root", 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.17;
// if (TMVAGlob::UsePaperStyle) newMargin2 = 0.13;
c->SetGrid();
c->SetTicks();
c->SetLeftMargin ( 0.17 );
c->SetBottomMargin( 0.15 );
c->SetRightMargin ( 0.13 );
c->SetTopMargin ( 0.10 );
gStyle->SetPalette( 1, 0 );
gStyle->SetPaintTextFormat( "3g" );
h2->SetTitle("");
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 = "plots/";
fname += hName[ic];
TMVAGlob::imgconv( c, fname );
}
}