Hi,
I am facing an unpleasant difficulty when I trie to plot some data with two different range on the x axis. I can not get the ticks of the up axis out of the down axis. I will appreciate some help.
[code]
void dispersion(){
gStyle->SetPadTickX(0);
gStyle->SetPadTickY(0);
TFile* file = new TFile(“sh.root”,“read”);
TNtuple* ntuple = (TNtuple*) file->Get(“ntuple”);
TCanvas* canvas = new TCanvas(“canvas”,“Dispersion”,700,500);
TPad *pad = new TPad(“pad”,"",0,0,1,1);
pad->Draw();
pad->cd();
TH1F *hr = pad->DrawFrame(0.74,1.74,0.9,1.95);
pad->GetFrame()->SetFillColor(0);
ntuple->Draw(“fun:lam”,"",“goff”);
TGraph* gFun = new TGraph(ntuple->GetSelectedRows(),ntuple->GetV2(),ntuple->GetV1());
ntuple->Draw(“pri:lam”,"",“goff”);
TGraph* gPri = new TGraph(ntuple->GetSelectedRows(),ntuple->GetV2(),ntuple->GetV1());
ntuple->Draw(“seg:lam”,"",“goff”);
TGraph* gSeg = new TGraph(ntuple->GetSelectedRows(),ntuple->GetV2(),ntuple->GetV1());
ntuple->Draw(“ter:lam”,"",“goff”);
TGraph* gTer = new TGraph(ntuple->GetSelectedRows(),ntuple->GetV2(),ntuple->GetV1());
ntuple->Draw(“qua:lam”,"",“goff”);
TGraph* gQua = new TGraph(ntuple->GetSelectedRows(),ntuple->GetV2(),ntuple->GetV1());
ntuple->Draw(“qui:lam”,"",“goff”);
TGraph* gQui = new TGraph(ntuple->GetSelectedRows(),ntuple->GetV2(),ntuple->GetV1());
ntuple->Draw(“sex:lam”,"",“goff”);
TGraph* gSex = new TGraph(ntuple->GetSelectedRows(),ntuple->GetV2(),ntuple->GetV1());
ntuple->Draw(“set:lam”,"",“goff”);
TGraph* gSet = new TGraph(ntuple->GetSelectedRows(),ntuple->GetV2(),ntuple->GetV1());
TMultiGraph *mg = new TMultiGraph();
mg->Add(gFun);
mg->Add(gPri);
mg->Add(gSeg);
mg->Add(gTer);
mg->Add(gQua);
mg->Add(gQui);
mg->Add(gSex);
mg->Draw(“same l”);
canvas->cd();
TPad *overlay = new TPad(“overlay”,"",0,0,1,1);
overlay->SetFillStyle(4000);
overlay->SetFillColor(0);
overlay->SetFrameFillStyle(4000);
overlay->Draw();
overlay->SetTicks(0,0);
overlay->cd();
Double_t xmin = 1.5e-6;
Double_t ymin = pad->GetUymin();
Double_t xmax = 1.59e-6;
Double_t ymax = pad->GetUymax();
TH1F *hframe = overlay->DrawFrame(xmin,ymin,xmax,ymax);
hframe->GetXaxis()->SetLabelOffset(99);
hframe->GetYaxis()->SetLabelOffset(99);
hframe->GetYaxis()->SetTickLength(0);
ntuple->Draw(“funp:lamp”,"",“goff”);
TGraph* gPum = new TGraph(ntuple->GetSelectedRows(),ntuple->GetV2(),ntuple->GetV1());
gPum->SetLineColor(2);
gPum->Draw(“same l”);
TGaxis *axis = new TGaxis(xmin,ymax,xmax,ymax,xmin,xmax,510,“L-”);
axis->SetLineColor(kRed);
axis->SetLabelColor(kRed);
axis->SetTitleOffset(0);
axis->Draw();
axis->SetTickLength(0);
}[/code]
Renato.