How to plot two scales?

i have two data to analyse .My purpose is to compare the two different data.So i want to plot them in the same picture.This is my programm:
I run it use root5.11 , it can use,but i download the root5.13, it can’t.
please you help me!
// Example of a canvas showing two histograms with different scales.
// The second histogram is drawn in a transparent pad
void t() {

TCanvas *c1 = new TCanvas(“c1”,“transparent pad”,200,10,700,500);
c1->SetFrameBorderMode(0);
c1->SetBorderMode(0);
c1->SetBorderSize(0);
//gStyle->SetOptStat(kFALSE);
TPad *pad1 = new TPad(“pad1”,"",0,0,1,1);
TPad *pad2 = new TPad(“pad2”,"",0,0,1,1);
// TPad *pad2 = new TPad(“pad2”,"",0.2,0.2,0.8,0.8);
pad2->SetFillStyle(4000); //will be transparent
pad1->Draw();
gStyle->SetOptStat(kFALSE);
pad1->cd();
pad1->SetBorderMode(0);
pad1->SetBorderSize(0);
pad1->SetFillColor(10);
FILE *fp;
fp=fopen(“data.txt”,“r”);

// TH1F *h1 = new TH1F(“h1”,"",744,1,745);
// TH1F *h2 = new TH1F(“h2”,"",744,1,745);

TH1F *h1 = new TH1F(“h1”,"",744,1,32);
TH1F *h2 = new TH1F(“h2”,"",744,1,32);

Float_t x,y1,y2;

for (Int_t i=1;i<744>SetBinContent(i,y1);
h2->SetBinContent(i,y2);
}
h1->SetLineWidth(1);
h1->SetLineStyle(2);
// h1->SetMarkerStyle(2);
//h1->SetMarkerSize(1);
// h1->SetMarkerColor(4);
h1->GetXaxis()->SetTitle(“Time(day,UT)”);
h1->GetXaxis()->CenterTitle();
h1->GetXaxis()->SetNdivisions(31);
h1->GetXaxis()->SetLabelSize(0.03);
h1->GetXaxis()->SetRangeUser(1,31.9);

h1->GetYaxis()->SetTitle(“P(mb)”);
h1->GetYaxis()->CenterTitle();
h1->GetYaxis()->SetLabelSize(0.03);

//gPad->SetTicky(0);
h1->Draw();
// h2->Draw();

pad1->Modified();
c1->cd();

//compute the pad range with suitable margins
Double_t ymin = 2850;
Double_t ymax = 3300;
Double_t dy = (ymax-ymin)/0.8; //10 per cent margins top and bottom
Double_t xmin = 1; //0.041667,30.041667
Double_t xmax = 32;
Double_t dx = (xmax-xmin)/0.8; //10 per cent margins left and right
pad2->Range(xmin-0.1dx,ymin-0.1dy,xmax+0.1dx,ymax+0.1dy);
pad2->Draw();
pad2->cd();
pad2->SetBorderMode(0);
pad2->SetBorderSize(0);
pad2->SetFillColor(10);
//h2->SetLineColor(kBlue);
h2->SetLineStyle(1);
h2->SetLineWidth(2);
h2->Draw(“lsames”);

leg = new TLegend(0.78,0.78,0.89,0.89);
leg->AddEntry(h1,“p”,“l”);
leg->AddEntry(h2,“counts”,“l”);

leg->SetBorderSize(0);
leg->SetFillColor(10);
leg->Draw();
pad2->Update();

// draw axis on the right side of the pad
TGaxis *axis = new TGaxis(xmax,ymin,xmax,ymax,ymin,ymax,510,"+L");

axis->SetTitle(“Counts”);
// axis->SetTitleColor(4);
// axis->SetLabelColor(4);
//axis->SetLineColor(4);
axis->CenterTitle();
axis->SetLabelSize(0.03);
//axis->SetTitleOffset(1);
axis->Draw();
}
nm.rar (9.42 KB)
nm.rar (9.42 KB)

When you post code in the body of your message, the forum screws it up because it tries to interpret HTML tags therefore it is not possible to do copy/paste (lots of editing is needed after). Can you post your macro as attachement or do not allow HTML in your profile ?

could you help me?

Send me directly your files via email at: Olivier.Couet@cern.ch

The problem is now fixed in the CVS head. Thanks to have reported it.

I run my programm in root5.11,please tell me what is the wrong in my programm?
How long could you solve the problem?
Thanks!

The macro transpad.C did not work because some modification in TH1::Draw had some side effect. This problem was introduced in the last development release. Now it is ok again. Is transpad.C working for you ? I understood it was not …

Could you check my program ? I would like the same plot as sample.pdf (in the attachment).
sample.pdf (589 KB)
nm.rar (9.42 KB)

Could you check my program ? I would like the same plot as sample.pdf (in the attachment).[/quote]

why not answer me?

Please post the shortest possible running script reproducing your problem
and in a format that does not force us to have to install a fancy unzipper.

Rene

Seems to me, with the fix I did (now in CVS head), your example runs fine. With your example I get the attached picture which I think is the same as the one in your pdf file.