hlabels1.C

Go to the documentation of this file.
00001 // 1-D histograms with alphanumeric labels
00002 // author; Rene Brun
00003 void hlabels1()
00004 {
00005    const Int_t nx = 20;
00006    char *people[nx] = {"Jean","Pierre","Marie","Odile","Sebastien",
00007       "Fons","Rene","Nicolas","Xavier","Greg","Bjarne","Anton","Otto",
00008       "Eddy","Peter","Pasha","Philippe","Suzanne","Jeff","Valery"};
00009    TCanvas *c1 = new TCanvas("c1","demo bin labels",10,10,900,500);
00010    c1->SetGrid();
00011    c1->SetTopMargin(0.15);
00012    TH1F *h = new TH1F("h","test",3,0,3);
00013    h->SetStats(0);
00014    h->SetFillColor(38);
00015    h->SetBit(TH1::kCanRebin);
00016    for (Int_t i=0;i<5000;i++) {
00017       Int_t r = gRandom->Rndm()*20;
00018       h->Fill(people[r],1);
00019    }
00020    h->LabelsDeflate();
00021    h->Draw();
00022    TPaveText *pt = new TPaveText(0.7,0.85,0.98,0.98,"brNDC");
00023    pt->SetFillColor(18);
00024    pt->SetTextAlign(12);
00025    pt->AddText("Use the axis Context Menu LabelsOption");
00026    pt->AddText(" \"a\"   to sort by alphabetic order");
00027    pt->AddText(" \">\"   to sort by decreasing values");
00028    pt->AddText(" \"<\"   to sort by increasing values");
00029    pt->Draw();
00030 }

Generated on Tue Jul 5 15:44:26 2011 for ROOT_528-00b_version by  doxygen 1.5.1