I previously found a way to move the TPaletteAxis drawn by TH2->Draw("colz"), however I don’t think it is a very good method / probably not the correct method, because using this code elsewhere in my macro caused a crash.
I have been using this to move the location of the TPaletteAxis, because sometimes the numbers drawn are so large they run off the end of the TCanvas / TPad.
Additionally, if ticks are enabled on the right hand side of a plot, then the TPaletteAxis covers them.
See the example screenshots below…
My method is kind of clunky and I guess that there is a better/simpler/more elegant way to do this?
I usually do the following, and this is pretty universal given you keep my size of the TCanvas:
TCanvas* canvas = new TCanvas("canvas", "Canvas title", 0, 0, 800, 600);
canvas->SetRightMargin(0.18); //to be able to see the z axis title, see https://root-forum.cern.ch/t/z-axis-title-th2f-colz/26426/3
histo->GetZaxis()->SetTitleOffset(1.3);
// draw your TH2 here