I want to edit the font size of the palette displayed when I plot a 2D histo in colz mode. In the classe TPaletteAxis, they say to do :
TPaletteAxis palette = (TPaletteAxis)h->GetListOfFunctions()->FindObject(“palette”)
The problem is, when I do that, *palette is 0… it does not find the object “palette”
This is a part of my code :
TApplication theApp(“App”,&argc,argv);
TCanvas *c = new TCanvas(“c”,“Canvas”,800,800);
TH2D *h2 = new TH2D(“h2”,“Escape current probability distribution”,iNbinsX,dXmin,dXmax,iNbinsY,dYmin,dYmax);
for (int i=0; i<vXML.size(); i++) {
double dX = getDoubleValue(vXML.at(i),cXaxisName);
vector<double> vY = vCurrents.at(i);
for (int j=0; j<vY.size(); j++) {
h2->Fill(dX,vY.at(j));
}
}
h2->SetStats(false);
h2->GetXaxis()->SetTitle(cXaxisName);
h2->GetXaxis()->CenterTitle(true);
h2->GetXaxis()->SetTitleSize(0.03);
h2->GetXaxis()->SetLabelSize(0.02);
h2->GetYaxis()->SetTitle("Current");
h2->GetYaxis()->CenterTitle(true);
h2->GetYaxis()->SetTitleSize(0.03);
h2->GetYaxis()->SetLabelSize(0.02);
gStyle->SetStatFontSize(0.02);
gStyle->SetLabelSize(0.02);
gStyle->SetPalette(55,0);
h2->Draw("COLZ");
TPaletteAxis * palette = (TPaletteAxis*)h2->GetListOfFunctions()->FindObject("palette");
cout << "palette = " << palette << endl;
on that line, I get : palette = 0
so the pointer is not initialized