TPad::Divide limitation to 50 x 50

corr_SmallestInterval_floatCutEff_linearBkg_100.pdf (1.7 MB) Dear Forum,

I am having trouble producing a plot of correlation between parameters like the one attached in pdf.
Specifically, I have a set of 100 parameters sampled from a distribution which I would like to plot as a triangular matrix of plots where the diagonal elements are TH1D distributions of parameter i and the off-diagonal ones are TH2D of correlation of parameter i vs j.

I do have a script that does that and it works as long as the number of parameters stays below 50. I have a method that builds the TCanvas and TPad for plotting as

TPad* MarkovChainManager::GetPlottingPad( std::string header, std::string footer, int canvasWidth, int canvasHeight, int nCol, int nRow )
  int columns = nCol;
  int rows = nRow;

  fCanvas = new TCanvas(("c_"+header).c_str(), header.c_str(), canvasWidth, canvasHeight);
  TPaveLabel* title = new TPaveLabel(0.1,0.96,0.9,0.99,("c_"+header).c_str());
  TDatime* now = new TDatime();
  TPaveLabel* date = new TPaveLabel(0.7,0.01,0.9,0.03,now->AsString());
  if( footer != "" ){
    TPaveLabel* footLabel = new TPaveLabel(0.1,0.01,0.6,0.03, footer.c_str() );
  TPad* graphPad = new TPad("Graphs","Graphs",0.01,0.05,0.95,0.95);

  return graphPad;

where fCanvas is a private class member. Then in another method, I would go

TPad* myPad = this->GetPlottingPad( "title", "", (int)(size*nPar),  (int)(size*nPar), (int)nPar, (int)nPar );

myPad->cd( padID );


where TH1D* h is a histogram defined and filled before, and padID can run from 1 to nPar * nPar. The issue I have is that no matter what size I assign to the canvas through the GetPlottingPad method (I tried values from 200 to 2000),

myPad->cd( padID ) 

returns 0, meaning TPad cannot retrieve correctly the pad.
TPad is correctly created (different from nullptr), and the whole code works just fine if

nPar <= 50

Is this an internal limitation of ROOT to prevent abnormal memory allocation? Is there a workaround to get the plot I want?

Thanks a lot for your time and suggestions.
I do apologize if the topic was already raised up by other users but I wasn’t able to find it.

ROOT Version: 6.06.04
Platform: scientific linux 6.6 x86_64
Compiler: g++ 4.9.3

Try with: graphPad->Divide(columns, rows, 1.e-6, 1.e-6);

Thanks a lot, so apparently the problem was that the default margin between sub-pads was too big.
Setting that solved the problem!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.