void boxplotexample() { gStyle->SetTimeOffset(0); TRandom *rand = new TRandom(); TDatime *dateBegin = new TDatime(2010,1,1,0,0,0); TDatime *dateEnd = new TDatime(2011,1,1,0,0,0); TH2I *h1 = new TH2I("h1","Machine A + B",12,dateBegin->Convert(),dateEnd->Convert(),1000,0,1000); TH2I *h2 = new TH2I("h2","Machine B",12,dateBegin->Convert(),dateEnd->Convert(),1000,0,1000); h1->GetXaxis()->SetTimeDisplay(1); h1->GetXaxis()->SetTimeFormat("%m/%y"); h1->GetXaxis()->SetTitle("Date [month/year]"); float myRand; for (int i = dateBegin->Convert(); i < dateEnd->Convert(); i+=86400*30) { for (int j = 0; j < 1000; j++) { myRand = rand->Gaus(500+sin(i/10000000.)*100,50); h1->Fill(i,myRand); myRand = rand->Gaus(500+sin(i/11000000.)*100,70); h2->Fill(i,myRand); } } h1->SetBarWidth(0.4); h1->SetBarOffset(-0.25); h2->SetBarWidth(0.4); h2->SetBarOffset(0.25); h2->SetLineColor(kRed); TCanvas *c1 = new TCanvas("c1","TrendChart"); int bits = 1; //Try to set the bits yourself -- (1 << 1) will activate the bit 1, (2 << 4) will write 2 - meaning 0b10 in the bits 4 and 5 bits |= (0 << 1); //1: 0 - X, 1 - Y bits |= (1 << 2); //2-3: 0: standard whisker, 1: 1.5*iqr, 2:free, 3:free bits |= (2 << 4); //4-5: 0: no median, 1: median as line, 2: median with errors, 3: median as circle bits |= (3 << 6); //6-7: 0: no mean, 1: mean as dashed line, 2: free, 3: mean as circle bits |= (1 << 8); //no outliers, 1: outliers bits |= (0 << 9); //0: do not show values within iqr, 1: show all values within iqr + outliers bits |= (0 << 10); //0: show outliers and all values in the candle line, 1: show them randomly bits |= (1 << 11); //no anker, 1: standard anker, 2: free, 3: free char out[255]; sprintf(out,"candlex opt(%d)",bits); h1->Draw(out); h2->Draw("candleX opt(2537) same"); TLegend *leg = new TLegend(0.6,0.7,0.7,0.8); leg->AddEntry(h1,"Machine A","f"); leg->AddEntry(h2,"Machine B","f"); leg->Draw(); }