Hi Fred,
An example below. Change the divisions/pad orientation, margins
as you want. You can also replace SetRange by SetRangeUser
in case your values are in user coordinates instead of bin
numbers.
Rene Brun
void fred() {
TH1F h("h","full",10000,-3,3);
h.FillRandom("gaus",1000000);
TCanvas *c1 = new TCanvas("c1","test",10,10,600,900);
c1->Divide(1,3);
c1->cd(1);
TH1F *h1 = (TH1F*)h.Clone("h1");
h1->GetXaxis()->SetRange(100,300);
h1->Draw();
c1->cd(2);
TH1F *h2 = (TH1F*)h.Clone("h2");
h2->GetXaxis()->SetRange(2500,3500);
h2->Draw();
c1->cd(3);
TH1F *h3 = (TH1F*)h.Clone("h3");
h3->GetXaxis()->SetRange(5700,6200);
h3->Draw();
}
On Wed, 25
Jun 2003, Fred Sarazin wrote:
> Hi,
>
> I'd like to put on a single picture 3 different regions
> of the same histogram (to show the interesting features in
> my spectra). This means "breaking" the X-axis into 3 parts,
> let say 100-300 ; 2500-3500 ; 5700-6200.
> I suspect I need to divide my canvas into 3 pads, then put the axis
> by hands and draw my 3 parts separatly. I was wondering if
> someone had already found a more clever way to do it.
>
> Thanks,
>
> Fred
>
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET