gStyle -> SetOptStat(0);
TH2 * h = new TH2F("h", "h", 5, 0.0, 5.0, 5, 0.0, 5.0);
h -> Fill(2.0, 2.0);
TCanvas * c = new TCanvas();
h -> Draw("COLZ");
c -> SetRightMargin(0.5);
The output from the script is what was really intended.
Why is there such a difference and how to bring the output from CLING in conformity to the output from the script?
ROOT Version: Not Provided Platform: Not Provided Compiler: Not Provided
When you have multiple statements (create a canvas, histogram, set line color, change drawing option etc), there is no interruption that ROOT could use to paint the histogram. gPad->Modified() tells the gPad that it should re-paint itself on the next gPad->Update() call.
In cling, after each input line, the current canvas gets updated automatically. So here, painting (of the histogram and the palette axis) happens before the final SetRightMargin(0.5);, while for the script case, the palette axis is drawn afterSetRightMargin(0.5);.
Running c->SetRightMargin(0.5); before h->Draw("COLZ"); fixes this for both cases.