Z axis title - th2f colz


My problem is: I have a “colz” TH2F and I can not give title to the z axis. The command h2->GetZaxis()->SetTitle() doesn’t work. Anyone can help me?


In the beginning, try:
TH2F *h = new TH2F(“h”, “My histo;My X axis;My Y axis;My Z axis”, …);
or later:
h->SetTitle(“My histo;My X axis;My Y axis;My Z axis”);
and then:

BTW. If you first draw your histogram and then you h->GetZaxis()->SetTitle(“My New Z Title”);, then you should execute: gPad->Modified(); gPad->Update();

root [0] TCanvas *c = new TCanvas()
root [1] c->SetRightMargin(0.2)
root [2] hpxpy->GetZaxis()->SetTitle("Z title")
root [3] hpxpy->SetStats(0);
root [4] hpxpy->Draw("colz")

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.