Created
August 30, 2014 08:33
-
-
Save cvson/3233c3e0f79990e152e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////// | |
// // | |
// @visionlib.postach.io // | |
// // | |
//////////////////////////////////// | |
void titleStyle(TH1* h1){ | |
h1->GetYaxis()->CenterTitle(); | |
h1->GetXaxis()->CenterTitle(); | |
h1->GetXaxis()->SetLabelSize(h1->GetXaxis()->GetTitleSize()*1.2); | |
h1->GetYaxis()->SetLabelSize(h1->GetYaxis()->GetTitleSize()*1.2); | |
h1->GetXaxis()->SetTitleSize(h1->GetXaxis()->GetLabelSize()*1.2); | |
h1->GetYaxis()->SetTitleSize(h1->GetYaxis()->GetLabelSize()*1.2); | |
h1->GetYaxis()->SetTitleOffset(0.9); | |
} | |
void ch01_marathon(){ | |
int minute; | |
int finisher; | |
ifstream cfile("ch01_marathon.txt"); | |
string dummyline; | |
getline(cfile,dummyline); | |
TH1F* hminute = new TH1F( "hminute", " " ,90,120,240); | |
while (!cfile.eof()){ | |
cfile >> minute >> finisher; | |
hminute->Fill(minute,finisher); | |
} | |
new TCanvas; | |
hminute->GetXaxis()->SetTitle("Time to complete (in minute)"); | |
hminute->GetYaxis()->SetTitle("Number of finishers"); | |
hminute->SetLineWidth(3); | |
Int_t ci; | |
ci = TColor::GetColor("#B45F04"); | |
hminute->SetLineColor(ci); | |
hminute->SetFillColor(36); | |
titleStyle(hminute); | |
hminute->Draw(); | |
gPad->Print("plots/ch01_marathon.png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment