#include #include #include void hcalign() { gStyle->SetPalette(kBird); gStyle->SetOptStat(0); gStyle->SetLabelSize(0.025,"Z"); Bool_t logz = kFALSE; TCanvas *c1 = new TCanvas("c1","TPaletteAxis, labels alignment ",300,10,700,700); c1->Divide(2,2); TH2F *hpxpy = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4); // Fill histograms randomly TRandom3 randomNum; Float_t px, py; for (Int_t i = 0; i < 25000; i++) { randomNum.Rannor(px,py); hpxpy->Fill(px,py); } hpxpy->SetContour(8); hpxpy->SetMaximum(200); c1->cd(1); gPad->SetLogz(logz); hpxpy->SetTitle("Default"); hpxpy->DrawCopy("COL Z"); c1->cd(2); gPad->SetLogz(logz); hpxpy->SetTitle("Option: CJUST"); hpxpy->DrawCopy("COL Z CJUST"); Double_t zcontours[5] = {0, 20, 40, 80, 120}; hpxpy->SetContour(5, zcontours); c1->cd(3); gPad->SetLogz(logz); hpxpy->SetTitle("User contours, default"); hpxpy->DrawCopy("COL Z"); c1->cd(4); gPad->SetLogz(logz); hpxpy->SetTitle("User contours, CJUST"); hpxpy->DrawCopy("COL Z CJUST"); c1->SaveAs("calign.pdf"); }