Hi Marc,
It is not totally clear what you want to do from your example.
Here is an example using a transparent pad that you can adapt
to your case:
{
TH1F *h1 = new TH1F("h1","h1",100,-4,4);
TProfile *h2 = new TProfile("h2","pz vs px",100,-3,3,0,20);
Float_t px, py, pz;
for (Int_t i = 0; i < 25000; i++) {
gRandom->Rannor(px,py);
pz = px*px + py*py;
h1->Fill(px);
h2->Fill(px,pz);
}
h1->Draw();
TPad *pad = new TPad("pad","pad",0,0,1,1);
pad->SetFillStyle(4000);
pad->SetFrameFillStyle(4000);
pad->Draw();
pad->cd();
pad->SetLeftMargin(0.2);
pad->SetBottomMargin(0.2);
h2->Draw();
}
Rene Brun
On Tue, 5 Mar 2002, Marc Brueggemann wrote:
>
> Hello ROOTers,
>
> I have a problem with drawing two histograms which have different scales
> and different origins in one pad.
> Applying the tutorial "Superimposing two histograms with two different
> scales" works quite well, but only if you want to draw the second
> histogram with respect to the axis of the first histogram.
>
> I have a histogram which also has negative values, but I want my second
> histogram to be drawn with its origin in the lower left corner of the pad
> and not starting somewhere in the middle of the pad only because the
> origin of the first histogram is located there.
> If the second histogram would be drawn with respect to the NEW axis
> where I have put the origin to the lower edge of the pad (like in the
> tutorial) then everything would be perfect.
>
> To avoid that I confuse you, here's a simple example:
>
> Imagine to have a 1dim-histogram filled with arbitrary values like
>
> 2, 4, -5, -7, 3, 5, 2, 1, -1 etc.
>
> in this case its origin would be located somewhere on the left side of the
> pad, but NOT in the lower left corner.
> Now you want to draw an x^2-function in it [it's just an example ;) ]
> What happens now, if you use the tutorial, is that the x^2-function starts
> somewhere on the left side where the origin of the first histogram is
> located. But that looks ugly.
> Because also a new (red) scale is produced on right side of the pad
> which is valid for the new histogram it doesn't matters if the second
> histogram is not drawn with respect to the origin of the first histogram.
> The origin of the new axis is important.
>
> I tried to find a way to let the x^2-function be drawn with its origin in
> the lower left corner of the pad, but I wasn't successful for almost one
> week now. So, if anybody can help me out that would be awesome.
>
> Thanks ...
>
> --
> Marc Brueggemann mailto:bruegge@Physik.Uni-Dortmund.DE
> Experimentelle Physik Vb phone: +49 (231) 755 3667
> Dortmund University
> D-44227 Dortmund
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:44 MET