Hello,
I have a problem. I’m trying to set just 4 ticks on my histogram. To do that I use
SetNdivisions(4,kFALSE)
It works, but then if I want to set some labels on histogram everything is messed up. Could someone explain what is the problem and how to solve it. Here is whole code for macro (crucial are last four lines):
{
//=========Macro generated from canvas: c1/c1
//========= (Thu Jun 11 11:12:14 2009) by ROOT version5.22/00a
TCanvas *c1 = new TCanvas("c1", "c1",12,48,700,500);
c1->Range(-95.00001,-0.13125,865,1.18125);
c1->SetBorderSize(2);
TH1 *h = new TH1F("SUMDIG_ndigis_Barrel","SUMDIG_ndigis_Barrel",768,1,769);
TPaveStats *ptstats = new TPaveStats(0.78,0.835,0.98,0.995,"brNDC");
ptstats->SetName("stats");
ptstats->SetBorderSize(2);
ptstats->SetFillColor(19);
ptstats->SetTextAlign(12);
TText *text = ptstats->AddText("SUMDIG_ndigis_Barrel");
text->SetTextSize(0.0368);
text = ptstats->AddText("Entries = 0 ");
text = ptstats->AddText("Mean = 0");
text = ptstats->AddText("RMS = 0");
ptstats->SetOptStat(1111);
ptstats->SetOptFit(0);
ptstats->Draw();
h->GetListOfFunctions()->Add(ptstats);
ptstats->SetParent(h->GetListOfFunctions());
h->GetXaxis()->SetTitle("Modules");
h->GetYaxis()->SetTitle("mean ndigis per Module");
h->Draw("");
TPaveText *pt = new TPaveText(0.01,0.9390678,0.3748276,0.995,"blNDC");
pt->SetName("title");
pt->SetBorderSize(2);
pt->SetFillColor(19);
text = pt->AddText("SUMDIG_ndigis_Barrel");
pt->Draw();
c1->Modified();
c1->cd();
c1->SetSelected(c1);
TAxis* axis = h->GetXaxis();
axis->SetNdivisions(4,kFALSE);
axis->SetBinLabel(193,"Shell");
axis->LabelsOption("h");
}
I would appreciate any help.