Issue with adding another axis on top of TGraph

Dear all,

I am trying to add another axis in multigraph on top of x-axis. But, my new axis is overlapping with the old one and also I am not able to fix the tick same as bottom on top. I am pasting my part of code below[1]. Please let me know how I can fix it.

Thanks in advance.

With regards,
Ram

[1]

TMultiGraph *mg = new TMultiGraph("mg",";Current Supplied to HV Divider (#mu A);Efficiency");
mg->Add(gr1);
mg->SetMaximum(1.01);
mg->SetMinimum(0.0);
mg->Draw("AP");
mg->GetXaxis()->SetLimits(560,750);
mg->GetYaxis()->SetDecimals(1);
   TGaxis *axis_1 = new TGaxis(560,1.01,750,1.01, 0.560*4.7,0.750*4.7,510,"-");
   axis_1->SetTitle("V_Drift (kV)");
   axis_1->SetLineColor(kBlack);
   axis_1->SetLabelColor(kBlack);
   axis_1->Draw("sames");

It seems you asked for additional ticks on top of the plot. Don’t …

Dear Couet,

Yes, I am asking about the additional ticks.

Also, about synchronising the ticks on top and the bottom x-axis.

with regards,
Ram

can you provide a complete example reproducing what you are doing ?

Dear Couet,

Please find the code here [1] and input data here [2].

with regards,
Ram

[1] GE11sTimeResolution_vs_current_TestEx.C (5.3 KB)
[2] TimeResolution_etaphi52_ArCO2.txt (131 Bytes)

pad->SetTicks(0, 1);

Thank you very much Coyote. It worked.

But, the bigger upper ticks are not in sync with the grid. Is there any standard way to sync it?

with regards,
Ram

add option “N” in the TGaxis constructor. It will will “-N”

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.