Set name of palette in TH2D when drawing with COLZ

Hi,

I have the following code:

rfile = TFile(file_dir)
histogram = rfile.Get(hist_name)

canvas = TCanvas("canvas", "canvas", 1000, 600)
histogram.GetXaxis().SetTitle("M_0")
histogram.GetYaxis().SetTitle("M_1/2")
histogram.GetZaxis().SetTitle("chi2")

histogram.Draw("COLZ")
ROOT.gPad.Update()
ROOT.gStyle.SetOptStat(0)# Do not print the stat box

canvas.Print("./data.png")

But I cannot see the “chi2” title for the COLZ palette on the right side

Anyone has an idea how to solve this?

Jan


1 Like

The title seems to be out of the canvas, in the right part, cropped.

Resize your pad with the mouse so that it fits better. Or the SetRightMargin function.
Or maybe make the z-labels smaller?

Thanks, it works!