Second x axis for th1

HI! I would know if it’s possible to have two different x axes in th1: one is the “real” and the secondr is useful to have another kind of scale for the same bins. For example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 … (real axis)
1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 … (second axis)

see this example

void axis2() { TH1F *h = new TH1F("h","test",30,-3,3); h->FillRandom("gaus",10000); h->Draw(); TText t; t.SetTextSize(0.02); t.SetTextAlign(22); Double_t yt = - h->GetMaximum()/15.; for (Int_t i=1;i<=30;i++) t.DrawText(h->GetBinCenter(i),yt,Form("%d",i%10)); }

Rene

How would you do that in Python? I can’t get it to work… :unamused:

Actually I’m trying to implement it for a TGraph. Can anyone help?

[code]graph = ROOT.TGraph(number_of_entries, date, rate)
graph.GetXaxis().SetTimeDisplay(1);
graph.GetXaxis().SetTimeOffset(4,“gmt”);
graph.GetXaxis().SetTimeFormat("%d");
secondAxisText = ROOT.TText()
secondAxisText.SetTextSize(0.05);
secondAxisText.SetTextAlign(22);

#trying to display something in the axis area - not trying the for-loop yet
secondAxisText.DrawText(graph.GetHistogram().GetBinCenter(3),44.3,“foo”)
[/code]

Although I don’t get any error, I don’t see “foo” printed somewhere near of the x-axis.

Could anyone help?

Hi,

If you still have this problem, you may want to report/ask it on the PyROOT forum.

Cheers,
Philippe.