Example:
{
h = new TH1F("h1","h1",10,-3,3);
h->FillRandom("gaus",10000);
h->Fit("gaus");
for (int bin=1; bin<=10; bin++) {
h->GetXaxis()->SetBinLabel(bin,Form("Bin #%d",bin));
}
TF1 *g=h->GetListOfFunctions()->FindObject("gaus");
Double_t x1 = g->GetXmin(); Double_t x2 = g->GetXmax(); Double_t dx = (x2-x1)/100; Double_t x[100], y[100];
x1 = x1+dx; x[i] = x1; y[i] = g->Eval(x[i]);
h->GetYaxis()->Set(5,h->GetMinimum(),h->GetMaximum()); h->GetYaxis()->SetBinLabel(1,"aaa"); h->GetYaxis()->SetBinLabel(2,"bbb"); h->GetYaxis()->SetBinLabel(3,"bbb"); h->GetYaxis()->SetBinLabel(4,"bbb"); h->GetYaxis()->SetBinLabel(5,"ccc"); h->Draw("hbar2");
-----Original Message-----
From: owner-roottalk_at_root.cern.ch on behalf of liang
Sent: Thu 10/8/2009 20:15
To: roottalk_at_root.cern.ch
Cc: owner-roottalk_at_root.cern.ch; Zhijun Liang; Huaqiao Zhang
Subject: [ROOT] How to make horizontal histogram and superimposed horizontal fit without "hbar" option ?
Dear ROOT experts :
I am trying to make plot with horizontal histogram and superimposed
horizontal fit , Do you have any idea about how to do it ?
We don't want to use "hbar" option , just want a simple horizontal
histogram without any filled color , and superimposed a Gaussian fit
horizontally .
What I want is just some thing like the plot made the following simple
function , but put histogram and Gaussian fit horizontally .
Is that possible to do ? Do you have any Any suggestion ? Many Thanks
void makeplot(){
TH1F *h1=new TH1F("h1","h1",100,-3,3);
h1->FillRandom("gaus",10000); h1->Draw(""); h1->Fit("gaus");
Best regards
Zhijun
Received on Fri Oct 09 2009 - 09:31:40 CEST
This archive was generated by hypermail 2.2.0 : Fri Oct 09 2009 - 11:50:02 CEST