16 const char *month[nx] = {
"January",
"February",
"March",
"April",
17 "May",
"June",
"July",
"August",
"September",
"October",
18 "November",
"December"};
19 const char *people[ny] = {
"Jean",
"Pierre",
"Marie",
"Odile",
20 "Sebastien",
"Fons",
"Rene",
"Nicolas",
"Xavier",
"Greg",
21 "Bjarne",
"Anton",
"Otto",
"Eddy",
"Peter",
"Pasha",
22 "Philippe",
"Suzanne",
"Jeff",
"Valery"};
23 TCanvas *c1 =
new TCanvas(
"c1",
"demo bin labels",
26 c1->SetLeftMargin(0.15);
27 c1->SetBottomMargin(0.15);
28 TH2F *h =
new TH2F(
"h",
"test",nx,0,nx,ny,0,ny);
29 for (i=0;i<5000;i++) {
30 h->Fill(gRandom->Gaus(0.5*nx,0.2*nx),
31 gRandom->Gaus(0.5*ny,0.2*ny));
34 for (i=1;i<=nx;i++) h->GetXaxis()->SetBinLabel(i,month[i-1]);
35 for (i=1;i<=ny;i++) h->GetYaxis()->SetBinLabel(i,people[i-1]);
38 TPaveText *pt =
new TPaveText(0.6,0.85,0.98,0.98,
"brNDC");
41 pt->AddText(
"Use the axis Context Menu LabelsOption");
42 pt->AddText(
" \"a\" to sort by alphabetic order");
43 pt->AddText(
" \">\" to sort by decreasing values");
44 pt->AddText(
" \"<\" to sort by increasing values");