TCanvas* c1 = new TCanvas("c1", "My awesome plot", 0, 0, 800, 600);
c1->SetRightMargin(0.18); // to be able to see the z axis title
TH2F *myHist = new TH2F("myHist", "My histogram;#Delta#phi;#Delta#eta;C(#Delta#eta, #Delta#phi)", 24, -6., +6., 20, -5., +5.);
myHist->Fill(3., 3., 2500.);
myHist->Fill(-3., -3., 10.);
myHist->Draw("LEGO2 COLZ");
gPad->Update(); // to be able to retrieve the palette pointer
TPaletteAxis *palette = static_cast<TPaletteAxis*>(myHist->GetListOfFunctions()->FindObject("palette"));
if (palette)
{
palette->SetX1NDC(palette->GetX1NDC()+0.05); // shift x1 by 0.05 to the right
palette->SetX2NDC(palette->GetX2NDC()+0.05); // shift x2 by 0.05 to the right
}
gPad->Update(); gPad->Modified();