The second (custom) y axis moves from place after SaveAs

I draw few TGraphs together and then add second Y-axis on the right hand side of gpad. if I put “SaveAs” before drawing the second axis, it shown on the screen fine:
, but when I open the saved file, it has no second axis. Then I put the “SaveAs” line after the new axis draw and it creates the picture with displaced location of the 2nd axis.
. And the same goes for the image saved.
Any help please ?

Yes that’s weird. Can you post a macro reproducing this issue ?
I tried with the standard example transpad.C (which dos that too) and the additional axis is at the right place after a SaveAs in a pdf file.

Sure, here I made the macro short, also attached small input file.
You can produce both the pictures by commenting and un-commenting the SaveAs line.
test_macro.C (9.79 KB)
S_bg_sub_thd16_thp16_fi180.dat (1.27 KB)

After some clean up it works…
test_macro.C (5.1 KB)

I see, it works by placing following two lines…

can1->Modified(); can1->Update(); TGaxis *right_axis = new TGaxis(gPad->GetUxmax(),gPad->GetUymin(), gPad->GetUxmax(), gPad->GetUymax(),0,rightmax,505,"+L");
…just before defining the new TGaxis.
solved. Thanks :slight_smile:

and doing the SaveAS at the end.